Replace use of RandomAccessFile with FileOutputStream, which avoids
synchronization costs and the need to count/truncate the file.
Patch by: jat
Review by: spoon (desk review)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4211 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/Util.java b/dev/core/src/com/google/gwt/dev/util/Util.java
index 53e5f0c..e700a56 100644
--- a/dev/core/src/com/google/gwt/dev/util/Util.java
+++ b/dev/core/src/com/google/gwt/dev/util/Util.java
@@ -1046,17 +1046,14 @@
*/
public static void writeBytesToFile(TreeLogger logger, File where,
byte[][] what) throws UnableToCompleteException {
- RandomAccessFile f = null;
+ FileOutputStream f = null;
Throwable caught;
try {
where.getParentFile().mkdirs();
- f = new RandomAccessFile(where, "rwd");
- long newLen = 0;
+ f = new FileOutputStream(where);
for (int i = 0; i < what.length; i++) {
- newLen += what[i].length;
f.write(what[i]);
}
- f.setLength(newLen);
return;
} catch (FileNotFoundException e) {
caught = e;