@Test public void readsContentOfEntityStreamAsDataSource() throws Exception { DataSource result = dataSourceEntityProvider.readFrom(DataSource.class, null, null, TEXT_PLAIN_TYPE, null, new ByteArrayInputStream(testContent)); assertTrue(result instanceof ByteArrayDataSource); byte[] bytes = ByteStreams.toByteArray(result.getInputStream()); assertArrayEquals(testContent, bytes); assertEquals(TEXT_PLAIN, result.getContentType()); }
@Override public DataSource readFrom(Class<DataSource> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { return createDataSource(entityStream, mediaType == null ? null : mediaType.toString()); }
DataSourceEntityProvider implements EntityProvider<DataSource> { @Override public DataSource readFrom(Class<DataSource> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { return createDataSource(entityStream, mediaType == null ? null : mediaType.toString()); } }
DataSourceEntityProvider implements EntityProvider<DataSource> { @Override public DataSource readFrom(Class<DataSource> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { return createDataSource(entityStream, mediaType == null ? null : mediaType.toString()); }  }
DataSourceEntityProvider implements EntityProvider<DataSource> { @Override public DataSource readFrom(Class<DataSource> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { return createDataSource(entityStream, mediaType == null ? null : mediaType.toString()); }  @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override DataSource readFrom(Class<DataSource> type,
                               Type genericType,
                               Annotation[] annotations,
                               MediaType mediaType,
                               MultivaluedMap<String, String> httpHeaders,
                               InputStream entityStream); @Override long getSize(DataSource dataSource, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(DataSource dataSource,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream); }
DataSourceEntityProvider implements EntityProvider<DataSource> { @Override public DataSource readFrom(Class<DataSource> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { return createDataSource(entityStream, mediaType == null ? null : mediaType.toString()); }  @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override DataSource readFrom(Class<DataSource> type,
                               Type genericType,
                               Annotation[] annotations,
                               MediaType mediaType,
                               MultivaluedMap<String, String> httpHeaders,
                               InputStream entityStream); @Override long getSize(DataSource dataSource, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(DataSource dataSource,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream);  }