dcsimg
How to combine 2 or more outputStream into a single output stream.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   rajesh_tiwari
Posted On:   Thursday, March 7, 2002 03:17 AM

Hi I wanted to combine two OutputStream Object into a Single OutputStream object.Requirement is I get number of report output in different OutputStream object, but finally all the OutputStream should combine into one and shown to user as one single report. I have done it using the RandomAccessFile, but in that case I am converting the OutputStream into a physical file, so just to avoid the creation of physical file, it has to be done on Stream level.

Regds, Rajesh

Re: How to combine 2 or more outputStream into a single output stream.

Posted By:   Laurent_Mihalkovic  
Posted On:   Thursday, March 7, 2002 02:27 PM

not sure i fully understand your intentions.



I guess I would bypass the problem entirely by creating a MultiByteArrayOutputStream extending the ByteArrayOutputStream. Internally, I would use a vector of Byte[]. Then I would code something in the write() method that would recognize when a special sequence of characters is sent to the stream (something really stupid and unique), and use this as a signal to the output stream that it has to switch to a new buffer. Then in the toByteArray[] method, I would loop through all the Byte[] and aggregate them in one big lump.

makes sense?


laurent

About | Sitemap | Contact