Class ByteArrayResourceReader

java.lang.Object
org.springframework.geode.core.io.AbstractResourceReader
org.springframework.geode.core.io.support.ByteArrayResourceReader
All Implemented Interfaces:
ResourceReader

public class ByteArrayResourceReader extends AbstractResourceReader
A concrete AbstractResourceReader implementation that reads data from a target Resource's InputStream into a byte array.
Since:
1.3.1
See Also:
  • Field Details

  • Constructor Details

    • ByteArrayResourceReader

      public ByteArrayResourceReader()
  • Method Details

    • getBufferSize

      protected int getBufferSize()
      Returns the required 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.
      Returns:
      the required buffer size to read from the Resource in chunks.
    • doRead

      @NonNull protected byte[] doRead(@NonNull InputStream resourceInputStream) throws IOException
      Description copied from class: AbstractResourceReader
      Reads data from the target Resource (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.
      Specified by:
      doRead in class AbstractResourceReader
      Parameters:
      resourceInputStream - InputStream used to read data from the target Resource.
      Returns:
      a non-null byte array containing the data from the target Resource.
      Throws:
      IOException - if an I/O error occurs while reading from the Resource.
      See Also: