Streams { public static long copy(final InputStream is, final OutputStream os) throws IOException { return copy(is, os, 8192); } private  Streams(); static long copy(final InputStream is, final OutputStream os); static long copy(final InputStream is, final OutputStream os, final int buffSize); static long copy(final InputStream is, final OutputStream os, final int buffSize, final long maxBytes); static Writer asWriter(final Appendable appendable);  }
@Test public void testCopy() throws IOException { byte[] testArray = PipedOutputStreamTest.generateTestStr(10001).toString().getBytes(StandardCharsets.UTF_8); InputStream bis = new ByteArrayInputStream(testArray); ByteArrayOutputStream bos = new ByteArrayOutputStream(); Streams.copy(bis, bos); Assert.assertArrayEquals(testArray, bos.toByteArray()); }