Class S3ACachingInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.fs.s3a.prefetch.S3ARemoteInputStream
org.apache.hadoop.fs.s3a.prefetch.S3ACachingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.fs.CanSetReadahead,org.apache.hadoop.fs.statistics.IOStatisticsSource,org.apache.hadoop.fs.StreamCapabilities
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
org.apache.hadoop.fs.StreamCapabilities.StreamCapability -
Field Summary
Fields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Constructor Summary
ConstructorsConstructorDescriptionS3ACachingInputStream(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 theS3ACachingInputStreamclass. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this stream and releases all acquired resources.protected org.apache.hadoop.fs.impl.prefetch.BlockManagercreateBlockManager(org.apache.hadoop.fs.impl.prefetch.BlockManagerParameters blockManagerParameters, S3ARemoteObjectReader reader) protected booleanEnsures that a non-empty valid buffer is available for immediate reading.toString()Methods inherited from class org.apache.hadoop.fs.s3a.prefetch.S3ARemoteInputStream
available, getBlockData, getContext, getFile, getFilePosition, getIOStatistics, getName, getNextReadPos, getOffsetStr, getPos, getReader, getS3AStreamStatistics, getS3File, getS3ObjectAttributes, hasCapability, isClosed, mark, markSupported, read, read, read, reset, seek, setReadahead, skip, throwIfClosed, throwIfInvalidSeekMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
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 theS3ACachingInputStreamclass.- Parameters:
context- read-specific operation context.prefetchOptions- prefetch stream specific optionss3Attributes- 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
Description copied from class:S3ARemoteInputStreamCloses this stream and releases all acquired resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classS3ARemoteInputStream- Throws:
IOException- if there is an IO error during this operation.
-
ensureCurrentBuffer
Description copied from class:S3ARemoteInputStreamEnsures 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:
ensureCurrentBufferin classS3ARemoteInputStream- 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
- Overrides:
toStringin classS3ARemoteInputStream
-
createBlockManager
protected org.apache.hadoop.fs.impl.prefetch.BlockManager createBlockManager(@Nonnull org.apache.hadoop.fs.impl.prefetch.BlockManagerParameters blockManagerParameters, S3ARemoteObjectReader reader)
-