Use the ByteArrayInputStream to read the contents of the input stream intothe buffer used to construct a ByteArrayInputStream .Later you can then get your data back by accessing the buffer.