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.