Class S3AInMemoryInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.fs.s3a.prefetch.S3ARemoteInputStream
org.apache.hadoop.fs.s3a.prefetch.S3AInMemoryInputStream
- 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.
The entire file is read into memory before reads can begin.
Use of this class is recommended only for small files that can fit
entirely in memory.-
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
ConstructorsConstructorDescriptionS3AInMemoryInputStream(S3AReadOpContext context, PrefetchOptions prefetchOptions, S3ObjectAttributes s3Attributes, ObjectInputStreamCallbacks client, S3AInputStreamStatistics streamStatistics) Initializes a new instance of theS3AInMemoryInputStreamclass. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanEnsures that a non-empty valid buffer is available for immediate reading.Methods inherited from class org.apache.hadoop.fs.s3a.prefetch.S3ARemoteInputStream
available, close, 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, throwIfInvalidSeek, toStringMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
S3AInMemoryInputStream
public S3AInMemoryInputStream(S3AReadOpContext context, PrefetchOptions prefetchOptions, S3ObjectAttributes s3Attributes, ObjectInputStreamCallbacks client, S3AInputStreamStatistics streamStatistics) Initializes a new instance of theS3AInMemoryInputStreamclass.- Parameters:
context- read-specific operation context.prefetchOptions- prefetching options.s3Attributes- attributes of the S3 object being read.client- callbacks used for interacting with the underlying S3 client.streamStatistics- statistics for this stream.- Throws:
IllegalArgumentException- if context is null.IllegalArgumentException- if s3Attributes is null.IllegalArgumentException- if client is null.
-
-
Method Details
-
ensureCurrentBuffer
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:
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.
-