@Test public void readBytes() throws IOException { test(new CB() { public void run(boolean close) throws IOException { BAIS bais = new BAIS(bytes); assertArrayEquals(bytes, StreamUtil.readBytes(bais, close).toByteArray()); bais.assertClosed(close); } }); }
public static ByteArray readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); io(in, out); return out.toByteArray(); }
StreamUtil { public static ByteArray readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); io(in, out); return out.toByteArray(); } }
StreamUtil { public static ByteArray readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); io(in, out); return out.toByteArray(); }  }
StreamUtil { public static ByteArray readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); io(in, out); return out.toByteArray(); }  static void io(InputStream in, OutputStream out); static void io(InputStream in, OutputStream out, int bufferSize); static void io(Reader in, Writer out); static void io(Reader in, Writer out, int bufferSize); static void io(InputStream in, OutputStream out, boolean closeIn, boolean closeOut); static void io(Reader in, Writer out, boolean closeIn, boolean closeOut); static void io(InputStream in, File dest); static void io(InputStream in, File dest, boolean closeIn, boolean closeOut); static void io(InputStream in, String dest); static void io(InputStream in, String dest, boolean closeIn, boolean closeOut); static void io(Reader in, File dest); static void io(Reader in, File dest, boolean closeIn, boolean closeOut); static void io(Reader in, String dest); static void io(Reader in, String dest, boolean closeIn, boolean closeOut); static OutputStream synchronizedOutputStream(OutputStream out); static OutputStream synchronizedOutputStream(OutputStream out, Object lock); static String readText(InputStream in); static String readText(InputStream in, String encoding); static String readText(InputStream in, String charset, int bufferSize); static String readText(InputStream in, String charset, boolean closeIn); static String readText(Reader in, boolean closeIn); static String readText(Reader reader); static String readText(Reader reader, int bufferSize); static ByteArray readBytes(InputStream in); static ByteArray readBytes(InputStream in, boolean closeIn); static ByteArray readBytes(File file); static ByteArray readBytes(File file, boolean closeIn); static byte[] readBytesByFast(InputStream in); static byte[] readBytesByFast(InputStream in, boolean closeIn); static void writeText(CharSequence chars, OutputStream out, String charset, boolean closeOut); static void writeText(CharSequence chars, Writer out, boolean closeOut); static void writeBytes(byte[] bytes, String filePath, boolean closeOut); static void writeBytes(byte[] bytes, File file, boolean closeOut); static void writeBytes(byte[] bytes, OutputStream out, boolean closeOut); static void writeBytes(ByteArray bytes, OutputStream out, boolean closeOut); static void close(Closeable closed); }
StreamUtil { public static ByteArray readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); io(in, out); return out.toByteArray(); }  static void io(InputStream in, OutputStream out); static void io(InputStream in, OutputStream out, int bufferSize); static void io(Reader in, Writer out); static void io(Reader in, Writer out, int bufferSize); static void io(InputStream in, OutputStream out, boolean closeIn, boolean closeOut); static void io(Reader in, Writer out, boolean closeIn, boolean closeOut); static void io(InputStream in, File dest); static void io(InputStream in, File dest, boolean closeIn, boolean closeOut); static void io(InputStream in, String dest); static void io(InputStream in, String dest, boolean closeIn, boolean closeOut); static void io(Reader in, File dest); static void io(Reader in, File dest, boolean closeIn, boolean closeOut); static void io(Reader in, String dest); static void io(Reader in, String dest, boolean closeIn, boolean closeOut); static OutputStream synchronizedOutputStream(OutputStream out); static OutputStream synchronizedOutputStream(OutputStream out, Object lock); static String readText(InputStream in); static String readText(InputStream in, String encoding); static String readText(InputStream in, String charset, int bufferSize); static String readText(InputStream in, String charset, boolean closeIn); static String readText(Reader in, boolean closeIn); static String readText(Reader reader); static String readText(Reader reader, int bufferSize); static ByteArray readBytes(InputStream in); static ByteArray readBytes(InputStream in, boolean closeIn); static ByteArray readBytes(File file); static ByteArray readBytes(File file, boolean closeIn); static byte[] readBytesByFast(InputStream in); static byte[] readBytesByFast(InputStream in, boolean closeIn); static void writeText(CharSequence chars, OutputStream out, String charset, boolean closeOut); static void writeText(CharSequence chars, Writer out, boolean closeOut); static void writeBytes(byte[] bytes, String filePath, boolean closeOut); static void writeBytes(byte[] bytes, File file, boolean closeOut); static void writeBytes(byte[] bytes, OutputStream out, boolean closeOut); static void writeBytes(ByteArray bytes, OutputStream out, boolean closeOut); static void close(Closeable closed);  }