File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Merging byte arrays using SequenceInputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Merging byte arrays using SequenceInputStream" Watch "Merging byte arrays using SequenceInputStream" New topic
Author

Merging byte arrays using SequenceInputStream

avani vakharwala
Greenhorn

Joined: Jan 24, 2008
Posts: 6

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

Joined: Oct 27, 2005
Posts: 19679
    
  18

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:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Merging byte arrays using SequenceInputStream