### Question:
InputStreamEntity implements StreamingOutput { @Override public void write(OutputStream os) throws IOException { IOUtils.skipFully(is, offset); if (len == -1) { IOUtils.copyBytes(is, os, 4096, true); } else { IOUtils.copyBytes(is, os, len, true); } } InputStreamEntity(InputStream is, long offset, long len);  InputStreamEntity(InputStream is); @Override void write(OutputStream os);  }### Answer:
@Test public void test() throws Exception { InputStream is = new ByteArrayInputStream("abc".getBytes()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStreamEntity i = new InputStreamEntity(is); i.write(baos); baos.close(); assertEquals(new String(baos.toByteArray()), "abc"); is = new ByteArrayInputStream("abc".getBytes()); baos = new ByteArrayOutputStream(); i = new InputStreamEntity(is, 1, 1); i.write(baos); baos.close(); assertEquals(baos.toByteArray()[0], 'b'); }