Hi all,
Is it possible to create a stream originating from a byte[] array? I looked
for "memorystream" and anything approaching and could not find it.
Basically, I have an array of bytes, and I would like to read it via a
standart method that accepts streams as input.
Thanks!
Gordon Beaton - 25 Oct 2007 14:20 GMT
> Is it possible to create a stream originating from a byte[] array? I
> looked for "memorystream" and anything approaching and could not
> find it. Basically, I have an array of bytes, and I would like to
> read it via a standart method that accepts streams as input.
Hmm, ByteArrayInputStream maybe?
/gordon
--
Mike Schilling - 26 Oct 2007 01:10 GMT
>> Is it possible to create a stream originating from a byte[] array? I
>> looked for "memorystream" and anything approaching and could not
>> find it. Basically, I have an array of bytes, and I would like to
>> read it via a standart method that accepts streams as input.
>
> Hmm, ByteArrayInputStream maybe?
And the obverse in ByteArrayOutputStream. My guess is that the OP is a .NET
programmer looking for the Java equivalent of System.IO.MemoryStream.
Eric Sosman - 25 Oct 2007 14:28 GMT
> Hi all,
>
> Is it possible to create a stream originating from a byte[] array? I looked
> for "memorystream" and anything approaching and could not find it.
> Basically, I have an array of bytes, and I would like to read it via a
> standart method that accepts streams as input.
java.io.ByteArrayInputStream. See also CharArrayReader.

Signature
Eric Sosman
esosman@ieee-dot-org.invalid
Roedy Green - 25 Oct 2007 17:08 GMT
>Hi all,
>
>Is it possible to create a stream originating from a byte[] array? I looked
>for "memorystream" and anything approaching and could not find it.
>Basically, I have an array of bytes, and I would like to read it via a
>standart method that accepts streams as input.
see http://mindprod.com/applet/fileio.html
just tell it the source of your data is a byte[]
and it will generate you code.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com