@InterfaceAudience.Private
@InterfaceStability.Evolving
public class S3AInputStream
extends org.apache.hadoop.fs.FSInputStream
implements org.apache.hadoop.fs.CanSetReadahead
toString()
must also be considered unstable.Constructor and Description |
---|
S3AInputStream(org.apache.hadoop.fs.s3a.S3ObjectAttributes s3Attributes,
long contentLength,
com.amazonaws.services.s3.AmazonS3 client,
org.apache.hadoop.fs.FileSystem.Statistics stats,
S3AInstrumentation instrumentation,
long readahead,
S3AInputPolicy inputPolicy) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close()
Close the stream.
|
long |
getContentRangeFinish() |
long |
getContentRangeStart() |
long |
getPos() |
long |
getReadahead()
Get the current readahead value.
|
S3AInstrumentation.InputStreamStatistics |
getS3AStreamStatistics()
Access the input stream statistics.
|
boolean |
markSupported() |
int |
read() |
int |
read(byte[] buf,
int off,
int len)
This updates the statistics on read operations started and whether
or not the read operation "completed", that is: returned the exact
number of bytes requested.
|
void |
readFully(long position,
byte[] buffer,
int offset,
int length)
Subclass
readFully() operation which only seeks at the start
of the series of operations; seeking back at the end. |
long |
remainingInCurrentRequest()
Bytes left in the current request.
|
long |
remainingInFile()
Bytes left in stream.
|
boolean |
resetConnection()
Forcibly reset the stream, by aborting the connection.
|
void |
seek(long targetPos) |
boolean |
seekToNewSource(long targetPos) |
void |
setReadahead(Long readahead) |
String |
toString()
String value includes statistics as well as stream state.
|
read, readFully, validatePositionedReadArgs
mark, read, reset, skip
public S3AInputStream(org.apache.hadoop.fs.s3a.S3ObjectAttributes s3Attributes, long contentLength, com.amazonaws.services.s3.AmazonS3 client, org.apache.hadoop.fs.FileSystem.Statistics stats, S3AInstrumentation instrumentation, long readahead, S3AInputPolicy inputPolicy)
public long getPos() throws IOException
getPos
in interface org.apache.hadoop.fs.Seekable
getPos
in class org.apache.hadoop.fs.FSInputStream
IOException
public void seek(long targetPos) throws IOException
seek
in interface org.apache.hadoop.fs.Seekable
seek
in class org.apache.hadoop.fs.FSInputStream
IOException
public boolean seekToNewSource(long targetPos) throws IOException
seekToNewSource
in interface org.apache.hadoop.fs.Seekable
seekToNewSource
in class org.apache.hadoop.fs.FSInputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] buf, int off, int len) throws IOException
read
in class InputStream
IOException
- if there are other problemspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
- on any problem@InterfaceStability.Unstable public boolean resetConnection() throws IOException
read()
operation will trigger the opening of a new HTTPS
connection.
This is potentially very inefficient, and should only be invoked
in extreme circumstances. It logs at info for this reason.IOException
- if invoked on a closed stream.public int available() throws IOException
available
in class InputStream
IOException
@InterfaceAudience.Private @InterfaceStability.Unstable public long remainingInFile()
@InterfaceAudience.Private @InterfaceStability.Unstable public long remainingInCurrentRequest()
@InterfaceAudience.Private @InterfaceStability.Unstable public long getContentRangeFinish()
@InterfaceAudience.Private @InterfaceStability.Unstable public long getContentRangeStart()
public boolean markSupported()
markSupported
in class InputStream
@InterfaceStability.Unstable public String toString()
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException
readFully()
operation which only seeks at the start
of the series of operations; seeking back at the end.
This is significantly higher performance if multiple read attempts are
needed to fetch the data, as it does not break the HTTP connection.
To maintain thread safety requirements, this operation is synchronized
for the duration of the sequence.
readFully
in interface org.apache.hadoop.fs.PositionedReadable
readFully
in class org.apache.hadoop.fs.FSInputStream
IOException
@InterfaceAudience.Private @InterfaceStability.Unstable public S3AInstrumentation.InputStreamStatistics getS3AStreamStatistics()
public void setReadahead(Long readahead)
setReadahead
in interface org.apache.hadoop.fs.CanSetReadahead
public long getReadahead()
Copyright © 2018 Apache Software Foundation. All Rights Reserved.