6 Replies Latest reply: Jul 26, 2010 2:14 PM by dadams07 RSS

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

      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 ?