Class ByteArrayResourceReader
java.lang.Object
org.springframework.geode.core.io.AbstractResourceReader
org.springframework.geode.core.io.support.ByteArrayResourceReader
- All Implemented Interfaces:
ResourceReader
A concrete
AbstractResourceReader
implementation that reads data from a target Resource's
InputStream
into a byte array.- Since:
- 1.3.1
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
doRead
(InputStream resourceInputStream) Reads data from the targetResource
(intentionally) by using theInputStream
returned byInputStreamSource.getInputStream()
.protected int
Returns the requiredbuffer size
used to capture data from the targetResource
in chunks.Methods inherited from class org.springframework.geode.core.io.AbstractResourceReader
isAbleToHandle, preProcess, read
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.geode.core.io.ResourceReader
readIntoByteBuffer, thenReadFrom
-
Field Details
-
DEFAULT_BUFFER_SIZE
protected static final int DEFAULT_BUFFER_SIZE- See Also:
-
-
Constructor Details
-
ByteArrayResourceReader
public ByteArrayResourceReader()
-
-
Method Details
-
getBufferSize
protected int getBufferSize()Returns the requiredbuffer size
used to capture data from the targetResource
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.- Returns:
- the required
buffer size
to read from theResource
in chunks.
-
doRead
Description copied from class:AbstractResourceReader
Reads data from the targetResource
(intentionally) by using theInputStream
returned byInputStreamSource.getInputStream()
. However, other algorithm/strategy implementations are free to read from theResource
as is appropriate for the given context (e.g. cloud environment). In those cases, implementors should override theAbstractResourceReader.read(Resource)
method.- Specified by:
doRead
in classAbstractResourceReader
- Parameters:
resourceInputStream
-InputStream
used to read data from the targetResource
.- Returns:
- a non-null byte array containing the data from the target
Resource
. - Throws:
IOException
- if an I/O error occurs while reading from theResource
.- See Also:
-