Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Merging byte arrays using SequenceInputStream

 
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
Pie
Posts: 20495
54
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic