InputStreamSerializer implements Serializer<InputStream> { public void serialize(InputStream value, Charset charset, OutputStream out) throws IOException { IOs.copy(value, out, true); }  void serialize(InputStream value, Charset charset, OutputStream out);  }
@Test public void shouldCopyInputStreamContentToGivenOutput() throws IOException { byte[] inBytes = Files.toByteArray(Values.IMAGE1); TestInputStream in = new TestInputStream(new FileInputStream(Values.IMAGE1)); ByteArrayOutputStream out = new ByteArrayOutputStream(); toTest.serialize(in, null, out); assertArrayEquals(inBytes, out.toByteArray()); assertTrue(in.hasBeenClosed()); }