Two Laptop Bag*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Merging byte arrays using SequenceInputStream" Watch "Merging byte arrays using SequenceInputStream" New topic

Merging byte arrays using SequenceInputStream

avani vakharwala

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

Joined: Oct 27, 2005
Posts: 19651

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:

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Merging byte arrays using SequenceInputStream
Similar Threads
send files over the socket
How to Change the File Name for Each Uploaded Files to the Socket Server?
SequenceInputStream performance
Problem in merging PPT files using java
Problem in setBinaryStream when using SequenceInputStream