@NotThreadSafe public class S3AInputStream extends InputStream
S3ObjectInputStream
which handles skips efficiently.Modifier and Type | Field and Description |
---|---|
protected String |
mBucketName
Name of the bucket the object resides in.
|
protected com.amazonaws.services.s3.AmazonS3 |
mClient
Client for operations with s3.
|
protected com.amazonaws.services.s3.model.S3ObjectInputStream |
mIn
The backing input stream from s3.
|
protected String |
mKey
The path of the object to read.
|
protected long |
mPos
The current position of the stream.
|
protected RetryPolicy |
mRetryPolicy
Policy determining the retry behavior in case the key does not exist.
|
Constructor and Description |
---|
S3AInputStream(String bucketName,
String key,
com.amazonaws.services.s3.AmazonS3 client,
long position,
RetryPolicy retryPolicy)
Constructor for an input stream of an object in s3 using the aws-sdk implementation to read the
data.
|
S3AInputStream(String bucketName,
String key,
com.amazonaws.services.s3.AmazonS3 client,
RetryPolicy retryPolicy)
Constructor for an input stream of an object in s3 using the aws-sdk implementation to read
the data.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected com.amazonaws.services.s3.AmazonS3 |
getClient() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int offset,
int length) |
long |
skip(long n) |
available, mark, markSupported, reset
protected com.amazonaws.services.s3.AmazonS3 mClient
protected final String mBucketName
protected final String mKey
protected com.amazonaws.services.s3.model.S3ObjectInputStream mIn
protected long mPos
protected final RetryPolicy mRetryPolicy
public S3AInputStream(String bucketName, String key, com.amazonaws.services.s3.AmazonS3 client, RetryPolicy retryPolicy)
bucketName
- the bucket the object resides inkey
- the path of the object to readclient
- the s3 client to use for operationsretryPolicy
- retry policy in case the key does not existpublic S3AInputStream(String bucketName, String key, com.amazonaws.services.s3.AmazonS3 client, long position, RetryPolicy retryPolicy)
bucketName
- the bucket the object resides inkey
- the path of the object to readclient
- the s3 client to use for operationsposition
- the position to begin reading fromretryPolicy
- retry policy in case the key does not existpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int offset, int length) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
protected com.amazonaws.services.s3.AmazonS3 getClient()
Copyright © 2023. All Rights Reserved.