• Post Reply Bookmark Topic Watch Topic
  • New Topic

Merging byte arrays using SequenceInputStream  RSS feed

 
avani vakharwala
Greenhorn
Posts: 6
Eclipse IDE Hibernate Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem :
Retrieving byte array from database
Storing each byte array in file
and Merging all those files in single file.

However ,I don't want to store file on disk.
Each byte array which i am retrieving from database should be merge together on fly as single large byte array.

I have tried using Byte Array (java.nio) but it is not giving me desired output.

Following is the code snippet
 
Rob Spoor
Sheriff
Posts: 21117
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you write to the single file while you loop over the ResultSet, effectively getting rid of all the temporary files?

In pseudo code:
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!