@NotThreadSafe
public class S3AOutputStream
extends java.io.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 java.lang.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(java.lang.String bucketName,
java.lang.String key,
com.amazonaws.services.s3.transfer.TransferManager manager,
java.util.List<java.lang.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 java.lang.String |
getUploadPath() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected final java.lang.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(java.lang.String bucketName,
java.lang.String key,
com.amazonaws.services.s3.transfer.TransferManager manager,
java.util.List<java.lang.String> tmpDirs,
boolean sseEnabled)
throws java.io.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 enabledjava.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionprotected java.lang.String getUploadPath()
protected com.amazonaws.services.s3.transfer.TransferManager getTransferManager()
Copyright © 2021. All Rights Reserved.