removing the redundant conversion code
@@ -107,12 +107,7 @@ public class BinaryDataProvider<T> extends AbstractConfigurableProvider
return clazz.cast(new InputStreamReader(is, getEncoding(type)));
}
if (byte[].class.isAssignableFrom(clazz)) {
- String enc = getCharset(type);
- if (enc == null) {
return clazz.cast(IOUtils.readBytesFromStream(is));
- } else {
- return clazz.cast(IOUtils.toString(is, bufferSize, enc).getBytes(enc));
- }
}
if (File.class.isAssignableFrom(clazz)) {
LOG.warning("Reading data into File objects with the help of pre-packaged"
@@ -191,9 +186,7 @@ public class BinaryDataProvider<T> extends AbstractConfigurableProvider
String enc = mt.getParameters().get("charset");
return enc == null ? StandardCharsets.UTF_8.name() : enc;
}
- private String getCharset(MediaType mt) {
- return mt.getParameters().get("charset");
- }
+
protected void copyInputToOutput(InputStream is, OutputStream os,
Annotation[] anns, MultivaluedMap<String, Object> outHeaders) throws IOException {
