@Test public void testFromOnString() throws IOException { final Object[][] testParameters = new Object[][] {{new CharArrayReader(new char[] {'a', 'b', 'c'}), "abc"}, {new StringReader("hello"), "hello"}}; for (final Object[] testParameter : testParameters) { String expected = (String) testParameter[1]; Reader reader = (Reader) testParameter[0]; assertEquals(expected, IoUtils.from(reader)); } }
public static byte[] from( final InputStream in) throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final byte[] bytes = new byte[10000]; int readBytes; while (0 < (readBytes = in.read(bytes))) { byteOut.write(bytes, 0, readBytes); } return byteOut.toByteArray(); }
IoUtils { public static byte[] from( final InputStream in) throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final byte[] bytes = new byte[10000]; int readBytes; while (0 < (readBytes = in.read(bytes))) { byteOut.write(bytes, 0, readBytes); } return byteOut.toByteArray(); } }
IoUtils { public static byte[] from( final InputStream in) throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final byte[] bytes = new byte[10000]; int readBytes; while (0 < (readBytes = in.read(bytes))) { byteOut.write(bytes, 0, readBytes); } return byteOut.toByteArray(); }  }
IoUtils { public static byte[] from( final InputStream in) throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final byte[] bytes = new byte[10000]; int readBytes; while (0 < (readBytes = in.read(bytes))) { byteOut.write(bytes, 0, readBytes); } return byteOut.toByteArray(); }  static void tryFlush(final Object... flushable); static int stream(final InputStream in, final StreamConsumer consumer); static int redirect(final InputStream from, final OutputStream to); static int redirect(final Reader from, final Writer to); static byte[] from(
      final InputStream in); static String from(
      final Reader reader); static byte[] getChecksum(final InputStream in); static String getChecksumAsString(final InputStream in); }
IoUtils { public static byte[] from( final InputStream in) throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final byte[] bytes = new byte[10000]; int readBytes; while (0 < (readBytes = in.read(bytes))) { byteOut.write(bytes, 0, readBytes); } return byteOut.toByteArray(); }  static void tryFlush(final Object... flushable); static int stream(final InputStream in, final StreamConsumer consumer); static int redirect(final InputStream from, final OutputStream to); static int redirect(final Reader from, final Writer to); static byte[] from(
      final InputStream in); static String from(
      final Reader reader); static byte[] getChecksum(final InputStream in); static String getChecksumAsString(final InputStream in);  }