0

I have byte array of file in database. I am creating java file from it. But it is consuming more time. Is there any way to create file faster than it. My attempts are as follows >>>

    Blob blob = null
while (rs.next()) {
                results.add([
                    blob = rs.getBlob("document")
                ])

File outputFile = new File("D:" + File.separator + it.documentDesc + extension);
FileOutputStream fout = new FileOutputStream(outputFile);
IOUtils.copy(blob.getBinaryStream(), fout);
File file = new File("D:" + File.separator + it.documentDesc + extension)
Sumon Bappi
  • 1,937
  • 8
  • 38
  • 82
  • 1
    I don't see any issues with your approach except that you can use IOUtils.copyLarge() instead of copy() method. – Vijay May 16 '16 at 13:01
  • 1
    if you are expecting only one row from resultset, you should use if(rs.next()) instead of while. – Vijay May 16 '16 at 13:04

0 Answers0