TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Programing Languages > Java

Memory stream

Java

 
 
Thread Tools Display Modes
Unread 25-10-2007, 01:58 PM   #1
Ouabaine
Guest
 
Posts: n/a
Memory stream

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!


 
Unread 25-10-2007, 01:58 PM   #2
Gordon Beaton
Guest
 
Posts: n/a
Re: Memory stream

On Thu, 25 Oct 2007 15:18:10 +0200, Ouabaine wrote:
> 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

--
 
Unread 25-10-2007, 01:58 PM   #3
Eric Sosman
Guest
 
Posts: n/a
Re: Memory stream

Ouabaine wrote:
> 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.

--
Eric Sosman
esosman@ieee-dot-org.invalid
 
Unread 25-10-2007, 04:35 PM   #4
Roedy Green
Guest
 
Posts: n/a
Re: Memory stream

On Thu, 25 Oct 2007 15:18:10 +0200, "Ouabaine" <ouabaine@orange.fr>
wrote, quoted or indirectly quoted someone who said :

>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.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Unread 26-10-2007, 01:01 AM   #5
Mike Schilling
Guest
 
Posts: n/a
Re: Memory stream


"Gordon Beaton" <n.o.t@for.email> wrote in message
news:47209800$0$3492$8404b019@news.wineasy.se...
> On Thu, 25 Oct 2007 15:18:10 +0200, Ouabaine wrote:
>> 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.


 
 

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 01:46 PM.


vBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2013, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional