@Override
public T readFrom(Class<T> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
throws IOException, WebApplicationException {
DataSource dataSource = new StreamDataSource(entityStream, mediaType
.toString());
DataHandler dataHandler = new DataHandler(dataSource);
try {
Object content = dataHandler.getContent();
if (content.getClass().isAssignableFrom(type)) {