Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Memory stream

Thread view: 
Ouabaine - 25 Oct 2007 14:18 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.

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.