@NotThreadSafe public class S3AOutputStream extends OutputStream
close()
method is called. The data
transfer is done using a TransferManager
which manages the upload threads and handles
multipart upload.Modifier and Type | Field and Description |
---|---|
protected String |
mKey
Key of the file when it is uploaded to S3.
|
protected com.amazonaws.services.s3.transfer.TransferManager |
mManager
A
TransferManager to upload the file to S3 using Multipart Uploads. |
Constructor and Description |
---|
S3AOutputStream(String bucketName,
String key,
com.amazonaws.services.s3.transfer.TransferManager manager,
List<String> tmpDirs,
boolean sseEnabled)
Constructs a new stream for writing a file.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
protected com.amazonaws.services.s3.transfer.TransferManager |
getTransferManager() |
protected String |
getUploadPath() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected final String mKey
protected com.amazonaws.services.s3.transfer.TransferManager mManager
TransferManager
to upload the file to S3 using Multipart Uploads. Multipart Uploads
involves uploading an object's data in parts instead of all at once, which can work around S3's
limit of 5GB on a single Object PUT operation.
It is recommended (http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html)
to upload file larger than 100MB using Multipart Uploads.public S3AOutputStream(String bucketName, String key, com.amazonaws.services.s3.transfer.TransferManager manager, List<String> tmpDirs, boolean sseEnabled) throws IOException
bucketName
- the name of the bucketkey
- the key of the filemanager
- the transfer manager to upload the file withtmpDirs
- a list of temporary directoriessseEnabled
- whether or not server side encryption is enabledIOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
protected String getUploadPath()
protected com.amazonaws.services.s3.transfer.TransferManager getTransferManager()
Copyright © 2023. All Rights Reserved.