Remove Exception declaration in abstract Encoder
This commit is contained in:
parent
9d8c089a21
commit
aaa1281809
|
@ -47,14 +47,7 @@ public abstract class AbstractSingleValueEncoder<T> extends AbstractEncoder<T> {
|
|||
|
||||
return Flux.from(inputStream).
|
||||
take(1).
|
||||
concatMap(t -> {
|
||||
try {
|
||||
return encode(t, bufferFactory, elementType, mimeType, hints);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return Flux.error(ex);
|
||||
}
|
||||
});
|
||||
concatMap(t -> encode(t, bufferFactory, elementType, mimeType, hints));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,9 +58,8 @@ public abstract class AbstractSingleValueEncoder<T> extends AbstractEncoder<T> {
|
|||
* @param mimeType the mime type to process
|
||||
* @param hints Additional information about how to do decode, optional
|
||||
* @return the output stream
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
protected abstract Flux<DataBuffer> encode(T t, DataBufferFactory dataBufferFactory,
|
||||
ResolvableType type, MimeType mimeType, Map<String, Object> hints) throws Exception;
|
||||
ResolvableType type, MimeType mimeType, Map<String, Object> hints);
|
||||
|
||||
}
|
||||
|
|
|
@ -64,10 +64,15 @@ public class ResourceEncoder extends AbstractSingleValueEncoder<Resource> {
|
|||
|
||||
@Override
|
||||
protected Flux<DataBuffer> encode(Resource resource, DataBufferFactory dataBufferFactory,
|
||||
ResolvableType type, MimeType mimeType, Map<String, Object> hints) throws IOException {
|
||||
ResolvableType type, MimeType mimeType, Map<String, Object> hints) {
|
||||
|
||||
ReadableByteChannel channel = resource.readableChannel();
|
||||
return DataBufferUtils.read(channel, dataBufferFactory, bufferSize);
|
||||
try {
|
||||
ReadableByteChannel channel = resource.readableChannel();
|
||||
return DataBufferUtils.read(channel, dataBufferFactory, this.bufferSize);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
return Flux.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue