@InterfaceAudience.Private
@InterfaceStability.Unstable
public class SelectInputStream
extends org.apache.hadoop.fs.FSInputStream
implements org.apache.hadoop.fs.CanSetReadahead
| Modifier and Type | Field and Description |
|---|---|
static String |
SEEK_UNSUPPORTED |
| Constructor and Description |
|---|
SelectInputStream(S3AReadOpContext readContext,
S3ObjectAttributes objectAttributes,
com.amazonaws.services.s3.model.SelectObjectContentResult selectResponse)
Create the stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Aborts the IO.
|
int |
available() |
void |
close() |
long |
getPos() |
long |
getReadahead()
Get the current readahead value.
|
S3AInputStreamStatistics |
getS3AStreamStatistics()
Get the Stream statistics.
|
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read()
Read a byte.
|
int |
read(byte[] buf,
int off,
int len) |
int |
read(long position,
byte[] buffer,
int offset,
int length)
Read at a specific position.
|
void |
reset() |
void |
seek(long newPos)
Forward seeks are supported, but not backwards ones.
|
boolean |
seekToNewSource(long targetPos) |
void |
setReadahead(Long readahead)
Set the readahead.
|
long |
skip(long n) |
String |
toString()
String value includes statistics as well as stream state.
|
protected org.apache.hadoop.fs.PathIOException |
unsupported(String action)
Build an exception to raise when an operation is not supported here.
|
readFully, readFully, validatePositionedReadArgsreadpublic static final String SEEK_UNSUPPORTED
@Retries.OnceTranslated public SelectInputStream(S3AReadOpContext readContext, S3ObjectAttributes objectAttributes, com.amazonaws.services.s3.model.SelectObjectContentResult selectResponse) throws IOException
readContext - read contextobjectAttributes - object attributes from a HEAD requestselectResponse - response from the already executed callIOException - failurepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOException@Retries.OnceTranslated public long skip(long n) throws IOException
skip in class InputStreamIOExceptionpublic long getPos()
getPos in interface org.apache.hadoop.fs.SeekablegetPos in class org.apache.hadoop.fs.FSInputStreampublic void setReadahead(Long readahead)
setReadahead in interface org.apache.hadoop.fs.CanSetReadaheadreadahead - The readahead to use. null means to use the default.public long getReadahead()
@Retries.OnceTranslated public int read() throws IOException
SelectObjectContentEventException are translated into
IOExceptions.read in class InputStreamIOException - failure.@Retries.OnceTranslated public int read(byte[] buf, int off, int len) throws IOException
read in class InputStreamIOException@Retries.OnceTranslated public void seek(long newPos) throws IOException
seek in interface org.apache.hadoop.fs.Seekableseek in class org.apache.hadoop.fs.FSInputStreamnewPos - new seek position.org.apache.hadoop.fs.PathIOException - Backwards seek attempted.EOFException - attempt to seek past the end of the stream.IOException - IO failure while skipping bytesprotected org.apache.hadoop.fs.PathIOException unsupported(String action)
action - action which is unsupported.public boolean seekToNewSource(long targetPos)
throws IOException
seekToNewSource in interface org.apache.hadoop.fs.SeekableseekToNewSource in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreampublic void mark(int readLimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic void abort()
public int read(long position,
byte[] buffer,
int offset,
int length)
throws IOException
getPos() position
will fail with a PathIOException. See seek(long).
Unlike the base implementation And the requirements of the filesystem
specification, this updates the stream position as returned in
getPos().read in interface org.apache.hadoop.fs.PositionedReadableread in class org.apache.hadoop.fs.FSInputStreamposition - offset in the stream.buffer - buffer to read in to.offset - offset within the bufferlength - amount of data to read.org.apache.hadoop.fs.PathIOException - Backwards seek attempted.EOFException - attempt to seek past the end of the stream.IOException - IO failure while seeking in the stream or reading data.@InterfaceAudience.Private @InterfaceStability.Unstable public S3AInputStreamStatistics getS3AStreamStatistics()
@InterfaceStability.Unstable public String toString()
toString in class org.apache.hadoop.fs.FSInputStreamCopyright © 2008–2022 Apache Software Foundation. All rights reserved.