Author: toad
Date: 2007-09-08 16:58:27 +0000 (Sat, 08 Sep 2007)
New Revision: 15055
Modified:
trunk/freenet/src/freenet/support/io/FileUtil.java
Log:
no need for extra buffering here
Modified: trunk/freenet/src/freenet/support/io/FileUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FileUtil.java 2007-09-08 16:13:13 UTC
(rev 15054)
+++ trunk/freenet/src/freenet/support/io/FileUtil.java 2007-09-08 16:58:27 UTC
(rev 15055)
@@ -105,30 +105,24 @@
}
public static boolean writeTo(InputStream input, File target) throws
FileNotFoundException, IOException {
- BufferedInputStream bis = null;
DataInputStream dis = null;
FileOutputStream fos = null;
- BufferedOutputStream bos = null;
File file = File.createTempFile("temp", ".tmp");
try {
- bis = new BufferedInputStream(input);
- dis = new DataInputStream(bis);
+ dis = new DataInputStream(input);
fos = new FileOutputStream(file);
- bos= new BufferedOutputStream(fos);
int len = 0;
byte[] buffer = new byte[4096];
while ((len = dis.read(buffer)) > 0) {
- bos.write(buffer, 0, len);
+ fos.write(buffer, 0, len);
}
} catch (IOException e) {
throw e;
} finally {
if(dis != null) dis.close();
- if(bis != null) bis.close();
if(fos != null) fos.close();
- if(bos != null) bos.close();
}
return file.renameTo(target);