Class S3ACachingInputStream

All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.fs.CanSetReadahead, org.apache.hadoop.fs.statistics.IOStatisticsSource, org.apache.hadoop.fs.StreamCapabilities

public class S3ACachingInputStream extends S3ARemoteInputStream
Provides an InputStream that allows reading from an S3 file. Prefetched blocks are cached to local disk if a seek away from the current block is issued.
  • Constructor Details

    • S3ACachingInputStream

      public S3ACachingInputStream(S3AReadOpContext context, PrefetchOptions prefetchOptions, S3ObjectAttributes s3Attributes, ObjectInputStreamCallbacks client, S3AInputStreamStatistics streamStatistics, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.LocalDirAllocator localDirAllocator)
      Initializes a new instance of the S3ACachingInputStream class.
      Parameters:
      context - read-specific operation context.
      prefetchOptions - prefetch stream specific options
      s3Attributes - attributes of the S3a object being read.
      client - callbacks used for interacting with the underlying S3 client.
      streamStatistics - statistics for this stream.
      conf - the configuration.
      localDirAllocator - the local dir allocator instance.
      Throws:
      NullPointerException - if a required parameter is null.
  • Method Details

    • close

      public void close() throws IOException
      Description copied from class: S3ARemoteInputStream
      Closes this stream and releases all acquired resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class S3ARemoteInputStream
      Throws:
      IOException - if there is an IO error during this operation.
    • ensureCurrentBuffer

      protected boolean ensureCurrentBuffer() throws IOException
      Description copied from class: S3ARemoteInputStream
      Ensures that a non-empty valid buffer is available for immediate reading. It returns true when at least one such buffer is available for reading. It returns false on reaching the end of the stream.
      Specified by:
      ensureCurrentBuffer in class S3ARemoteInputStream
      Returns:
      true if at least one such buffer is available for reading, false otherwise.
      Throws:
      IOException - if there is an IO error during this operation.
    • toString

      public String toString()
      Overrides:
      toString in class S3ARemoteInputStream
    • createBlockManager

      protected org.apache.hadoop.fs.impl.prefetch.BlockManager createBlockManager(@Nonnull org.apache.hadoop.fs.impl.prefetch.BlockManagerParameters blockManagerParameters, S3ARemoteObjectReader reader)