public class ByteArrayResourceReader extends AbstractResourceReader
AbstractResourceReader implementation that reads data from a target Resource's
InputStream into a byte array.InputStream,
ByteArrayOutputStream,
Resource,
AbstractResourceReader| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
ByteArrayResourceReader() |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
doRead(java.io.InputStream resourceInputStream)
Reads data from the target
Resource (intentionally) by using the InputStream returned by
InputStreamSource.getInputStream(). |
protected int |
getBufferSize()
Returns the required
buffer size used to capture data from the target Resource
in chunks. |
isAbleToHandle, preProcess, readclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadIntoByteBuffer, thenReadFromprotected static final int DEFAULT_BUFFER_SIZE
protected int getBufferSize()
buffer size used to capture data from the target Resource
in chunks.
Subclasses are encouraged to override this method as necessary to tune the buffer size. By default, the
buffer size is 32K or 32768 bytes.buffer size to read from the Resource in chunks.@NonNull
protected byte[] doRead(@NonNull
java.io.InputStream resourceInputStream)
throws java.io.IOException
AbstractResourceReaderResource (intentionally) by using the InputStream returned by
InputStreamSource.getInputStream().
However, other algorithm/strategy implementations are free to read from the Resource as is appropriate
for the given context (e.g. cloud environment). In those cases, implementors should override
the AbstractResourceReader.read(Resource) method.doRead in class AbstractResourceReaderresourceInputStream - InputStream used to read data from the target Resource.Resource.java.io.IOException - if an I/O error occurs while reading from the Resource.InputStream,
AbstractResourceReader.read(Resource)