List of utility methods to do InputStream to Byte Array Convert
byte[] | inputStreamToByte(InputStream is) input Stream To Byte try { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = is.read()) != -1) { bytestream.write(ch); byte imgdata[] = bytestream.toByteArray(); bytestream.close(); ... |
byte[] | getBytes(InputStream inputStream) get Bytes ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int len = 0; while ((len = inputStream.read(buffer)) != -1) { byteBuffer.write(buffer, 0, len); return byteBuffer.toByteArray(); ... |
byte[] | toByteArray(InputStream is) to Byte Array if (null == is) return null; byte[] cache = new byte[1 * 1024]; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (int length; (length = is.read(cache)) != -1;) { buffer.write(cache, 0, length); is.close(); ... |
byte[] | streamToByteArray(InputStream paramInputStream) stream To Byte Array byte[] arrayOfByte = new byte[4096]; ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream(); while (true) { int i = paramInputStream.read(arrayOfByte); if (i == -1) break; localByteArrayOutputStream.write(arrayOfByte, 0, i); return localByteArrayOutputStream.toByteArray(); |
byte[] | transStreamToBytes(InputStream is, int buffSize) trans Stream To Bytes if (is == null) { return null; if (buffSize <= 0) { throw new IllegalArgumentException( "buffSize can not less than zero....."); byte[] data = null; ... |