Author: echatellier Date: 2014-06-16 23:28:48 +0200 (Mon, 16 Jun 2014) New Revision: 208 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/208 Log: Add buffer to speed up file writing on disk Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-16 09:14:38 UTC (rev 207) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-16 21:28:48 UTC (rev 208) @@ -24,11 +24,13 @@ * #L% */ +import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -72,7 +74,7 @@ // be sure that "is" is not closed because is can be a local fileinputstream // that hibernate must read to put in database InputStream is = new ByteArrayInputStream(getContent()); - FileOutputStream fos = new FileOutputStream(tmpLocalFile); + OutputStream fos = new BufferedOutputStream(new FileOutputStream(tmpLocalFile)); IOUtils.copy(is, fos); fos.close();