List of utility methods to do InputStream to Byte Array
byte[] | inputStreamToByteArray(InputStream is) input Stream To Byte Array ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { int ch = -1; while ((ch = is.read()) != -1) { byteStream.write(ch); return byteStream.toByteArray(); } finally { ... |
byte[] | inputStreamToByteArray(InputStream is) Generates byte array with contents of a stream ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] bytes = new byte[1024]; int length; while ((length = is.read(bytes)) != -1) { baos.write(bytes, 0, length); return baos.toByteArray(); |
byte[] | inputStreamToByteArray(InputStream is) input Stream To Byte Array ByteArrayOutputStream os = null; try { os = new ByteArrayOutputStream(); byte[] buffer = new byte[0xFFFF]; for (int len; (len = is.read(buffer)) != -1;) { os.write(buffer, 0, len); os.flush(); ... |
byte[] | inputStreamToByteArray(InputStream is) Read the ARC record content into a byte array. ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedInputStream buffis = new BufferedInputStream(is); BufferedOutputStream buffos = new BufferedOutputStream(baos); byte[] tempBuffer = new byte[BUFFER_SIZE]; int bytesRead; while ((bytesRead = buffis.read(tempBuffer)) != -1) { buffos.write(tempBuffer, 0, bytesRead); buffis.close(); buffos.flush(); buffos.close(); return baos.toByteArray(); |
byte[] | inputStreamToByteArray(InputStream is) input Stream To Byte Array ByteArrayOutputStream bout = new ByteArrayOutputStream(4096); byte[] buf = new byte[4096]; int len = 0; while ((len = is.read(buf)) != -1) { bout.write(buf, 0, len); bout.close(); return bout.toByteArray(); ... |
byte[] | inputStreamToByteArray(InputStream stream) Reads the contents of an stream until exhausted and converts contents to an array of bytes. if (stream == null) { return new byte[] {}; byte[] buffer = new byte[1024]; ByteArrayOutputStream output = new ByteArrayOutputStream(); boolean error = false; try { int numRead = 0; ... |
ByteArrayOutputStream | inputStreamToByteArrayOutputStream(final InputStream is) Read from an InputStream and return it as a ByteArrayOutputStream . final BufferedReader in = new BufferedReader(new InputStreamReader(is)); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final int pageSize = 1024; final byte[] buf = new byte[pageSize]; int ret = is.read(buf, 0, pageSize); while (ret > 0) { final byte[] bufPage = new byte[ret]; for (int i = 0; i < ret; i++) { ... |
byte[] | inputStreamToBytes(final InputStream aInputStream) Converts an input stream into a byte array if (aInputStream == null) { return null; final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); final byte[] buffer = new byte[8192]; int read = 0; do { read = aInputStream.read(buffer); ... |
byte[] | inputStreamToBytes(final InputStream ins) Takes a 'InputStream' and returns a byte array. byte[] ret = null; try { int len = 0; final byte[] buf = new byte[2048]; final ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((len = ins.read(buf)) != -1) { out.write(buf, 0, len); ret = out.toByteArray(); } catch (IOException e) { return ret; |
byte[] | inputStreamToBytes(InputStream in) Converts an InputStream to a byte[] ByteArrayOutputStream out = new ByteArrayOutputStream(); try { byte[] buffer = new byte[1024]; int len; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } catch (Exception e) { ... |