@Test public void testToByteArray2() { byte[] testArray = new byte[IOUtil.IO_COPY_BUFFER_SIZE + 1]; Random random = new Random(); random.nextBytes(testArray); try { byte[] result = IOUtil.toByteArray(new ByteArrayInputStream(testArray)); assertTrue(Arrays.equals(testArray, result)); } catch (IOException e) { e.printStackTrace(); assertTrue(false); } }
public static byte[] toByteArray(Reader in, String encoding) throws IOException { StringWriter out = new StringWriter(); copy(in, out); out.flush(); return out.toString().getBytes(encoding); }
IOUtil { public static byte[] toByteArray(Reader in, String encoding) throws IOException { StringWriter out = new StringWriter(); copy(in, out); out.flush(); return out.toString().getBytes(encoding); } }
IOUtil { public static byte[] toByteArray(Reader in, String encoding) throws IOException { StringWriter out = new StringWriter(); copy(in, out); out.flush(); return out.toString().getBytes(encoding); }  }
IOUtil { public static byte[] toByteArray(Reader in, String encoding) throws IOException { StringWriter out = new StringWriter(); copy(in, out); out.flush(); return out.toString().getBytes(encoding); }  static byte[] toByteArray(Reader in, String encoding); static byte[] toByteArray(InputStream in); static byte[] toByteArray( InputStream in, int size ); static int copy(InputStream in, OutputStream out); static int copy(Reader in, Writer out); }
IOUtil { public static byte[] toByteArray(Reader in, String encoding) throws IOException { StringWriter out = new StringWriter(); copy(in, out); out.flush(); return out.toString().getBytes(encoding); }  static byte[] toByteArray(Reader in, String encoding); static byte[] toByteArray(InputStream in); static byte[] toByteArray( InputStream in, int size ); static int copy(InputStream in, OutputStream out); static int copy(Reader in, Writer out); static final int IO_COPY_BUFFER_SIZE; }