ReaderEditor supports Reader injection analogous to InputStreamEditor (from Spring resource location)
Also, EncodedResource implements InputStreamSource now since it declares getInputStream() anyway. Issue: SPR-12876
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.springframework.core.io.InputStreamSource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -39,7 +40,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @see java.io.Reader
|
||||
* @see java.nio.charset.Charset
|
||||
*/
|
||||
public class EncodedResource {
|
||||
public class EncodedResource implements InputStreamSource {
|
||||
|
||||
private final Resource resource;
|
||||
|
||||
@@ -85,6 +86,7 @@ public class EncodedResource {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the {@code Resource} held by this {@code EncodedResource}.
|
||||
*/
|
||||
@@ -146,6 +148,7 @@ public class EncodedResource {
|
||||
* @see #requiresReader()
|
||||
* @see #getReader()
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.resource.getInputStream();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user