This discussion is archived
6 Replies Latest reply: Jul 26, 2010 12:14 PM by aksarben RSS

Is there best way to connect a dataInputStream with a dataOutputstream?

794822 Newbie
Currently Being Moderated
I use a the next to put data on 'memory'

ByteArrayOutputStream bytestream =new ByteArrayOutputStream();          
DataOutputStream datastream =     new DataOutputStream(bytestream);     

And the method to 'connect' de 'out' with the 'in' is by mean of pass an array :

ByteArrayInputStream bytestream_in =new ByteArrayInputStream(bytestream.toByteArray());          
DataInputStream datastream_in =new DataInputStream(bytestream_in);

Is there any way to do this better ?