IO { public static byte[] readByteArray(InputStream input) throws NestedIOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); } protected  IO(); static String tmpdir(); static Reader createReader(File file); static Reader createReader(File file,Charset charset); static Writer createWriter(File file); static Writer createWriter(File file,Charset charset); static void close(Closeable closeable); static byte[] readByteArray(InputStream input); static byte[] readByteArrayAndClose(InputStream is); static byte[] readByteArray(File file); static byte[] readByteArray(Reader reader); static byte[] readByteArrayAndClose(Reader reader); static byte[] readByteArray(InputStream input, long size); static byte[] readByteArray(InputStream input, int size); static String readString(File file,Charset encoding); static String readString(InputStream input, Charset encoding); static String readStringAndClose(InputStream is, Charset charset); static String readString(Reader input); static String readStringAndClose(Reader reader); static void writeString(File file, String string); static void writeString(File file,String string, Charset encoding); static void writeString(OutputStream out,String string,Charset encoding); static long copy(InputStream input, OutputStream output); static long copy(InputStream input, OutputStream output, byte[] buffer); static void copy(InputStream input, Writer output); static void copy(InputStream input, Writer output,@Nullable Charset encoding); static void copy(InputStream input, Writer output, String encoding); static long copy(Reader input, Writer output); static long copy(Reader input, Writer output, char[] buffer);  }
@Test public void testReadByteArrayReader() { Reader r = new StringReader("hello"); assertEquals("hello", new String(IO.readByteArray(r))); }