Spring Boot for VMware GemFire
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]doRead(InputStream resourceInputStream) Reads data from the targetResource(intentionally) by using theInputStreamreturned byInputStreamSource.getInputStream().protected intReturns the requiredbuffer sizeused to capture data from the targetResourcein chunks.Methods inherited from class org.springframework.geode.core.io.AbstractResourceReader
isAbleToHandle, preProcess, readMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 sizeused to capture data from the targetResourcein 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 sizeto read from theResourcein chunks.
-
doRead
Reads data from the targetResource(intentionally) by using theInputStreamreturned byInputStreamSource.getInputStream(). However, other algorithm/strategy implementations are free to read from theResourceas is appropriate for the given context (e.g. cloud environment). In those cases, implementors should override theAbstractResourceReader.read(Resource)method.- Specified by:
doReadin classAbstractResourceReader- Parameters:
resourceInputStream-InputStreamused 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:
-