### Question:
IOUtils { public static void copyStream(InputStream is, OutputStream os) throws IOException { Objects.requireNonNull(is, "is cannot be null"); Objects.requireNonNull(os, "os cannot be null"); byte[] buffer = new byte[4096]; int read; while ((read = is.read(buffer)) > -1) { os.write(buffer, 0, read); } os.close(); is.close(); }  static void delete(File file); static String getReaderAsString(Reader reader, int maxLen); static InputStream getResourceAsStream(String path, int maxLen); static Reader getResourceAsReader(String path, int maxLen); static String getResourceAsString(String path, int maxLen); static void copyStream(InputStream is, OutputStream os); static void copyCharStream(Reader reader, Writer writer); static void zipDir(File dir, String relativePath, ZipOutputStream zos); static File createJar(File baseDir, String jarName, Class... classes); static void closeSafely(Closeable... objects);  }### Answer:
@Test public void testCopyStream() throws IOException { byte[] original = new byte[]{0, 1, 2}; ByteArrayInputStream is = new ByteArrayInputStream(original); ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copyStream(is, os); byte[] copy = os.toByteArray(); assertEquals(3, copy.length); assertEquals(original.length, copy.length); for (int i = 0; i < original.length; i++) { assertEquals(original[i], copy[i]); } }