IOUtilities { public static void copyStreams(final InputStream in, final OutputStream out) throws IOException { copyStreams(in, out, DEFAULT_BUFFER_SIZE); } private  IOUtilities(); static void closeSilently(final Closeable closeable); static void copyStreams(final InputStream in, final OutputStream out); static void copyStreams(final InputStream in, final OutputStream out, final int bufferSize);  }
@Test public void shouldCopyStreams() throws IOException { String input = "image/jpeg jPEG jPG jPE"; InputStream in = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtilities.copyStreams(in, out); assertThat(out.toString(), is(input)); }