@NotThreadSafe
public class S3AInputStream
extends java.io.InputStream
S3ObjectInputStream which handles skips efficiently.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.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 java.lang.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(java.lang.String bucketName,
java.lang.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(java.lang.String bucketName,
java.lang.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) |
protected com.amazonaws.services.s3.AmazonS3 mClient
protected final java.lang.String mBucketName
protected final java.lang.String mKey
protected com.amazonaws.services.s3.model.S3ObjectInputStream mIn
protected long mPos
protected final RetryPolicy mRetryPolicy
public S3AInputStream(java.lang.String bucketName,
java.lang.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(java.lang.String bucketName,
java.lang.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 java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreampublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int offset,
int length)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionprotected com.amazonaws.services.s3.AmazonS3 getClient()
Copyright © 2021. All Rights Reserved.