InputStreamEntityProvider implements EntityProvider<InputStream> { @Override public InputStream readFrom(Class<InputStream> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { ApplicationContext context = ApplicationContext.getCurrent(); if (context.isAsynchronous()) { int bufferSize = context.getEverrestConfiguration().getMaxBufferSize(); return IOHelper.bufferStream(entityStream, bufferSize); } return entityStream; }  @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override InputStream readFrom(Class<InputStream> type,
                                Type genericType,
                                Annotation[] annotations,
                                MediaType mediaType,
                                MultivaluedMap<String, String> httpHeaders,
                                InputStream entityStream); @Override long getSize(InputStream t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(InputStream in,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream);  }
@Test public void readsContentOfEntityStreamAsInputStream() throws Exception { InputStream in = new ByteArrayInputStream(testContent); InputStream result = inputStreamEntityProvider.readFrom(InputStream.class, null, null, null, null, in); assertArrayEquals(testContent, ByteStreams.toByteArray(result)); }