List of utility methods to do ByteArrayOutputStream Create
String | getStreamContents(InputStream is) get Stream Contents byte[] buffer = new byte[1000]; int c = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); while ((c = is.read(buffer)) != -1) { bout.write(buffer, 0, c); return new String(bout.toByteArray()); |
byte[] | getStreamData(InputStream is) Read contents of stream into byte array. byte[] buff = new byte[COPY_BUFFER_SIZE]; ByteArrayOutputStream os = new ByteArrayOutputStream(); int count; while ((count = is.read(buff)) >= 0) { os.write(buff, 0, count); return os.toByteArray(); |