class StringEntityProvider implements EntityProvider<String> {

    @Override
    public String readFrom(Class<String> type,
                           Type genericType,
                           Annotation[] annotations,
                           MediaType mediaType,
                           MultivaluedMap<String, String> httpHeaders,
                           InputStream entityStream) throws IOException {
        return CharStreams.toString(new InputStreamReader(entityStream, getCharsetOrUtf8(mediaType)));
    }

}