Class MultiFileOutputStream
- java.lang.Object
- 
- java.io.OutputStream
- 
- software.amazon.encryption.s3.internal.MultiFileOutputStream
 
 
- 
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable,- OnFileDelete
 
 public class MultiFileOutputStream extends OutputStream implements OnFileDelete 
- 
- 
Constructor SummaryConstructors Constructor Description MultiFileOutputStream()Construct an instance to use the default temporary directory and temp file naming convention.MultiFileOutputStream(File root, String namePrefix)Construct an instance to use the specified directory for temp file creations, and the specified prefix for temp file naming.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()voidclose()voidflush()longgetDiskLimit()FilegetFile(int partNumber)StringgetNamePrefix()intgetNumFilesWritten()longgetPartSize()FilegetRoot()longgetTotalBytesWritten()MultiFileOutputStreaminit(UploadObjectObserver observer, long partSize, long diskLimit)Used to initialize this stream.booleanisClosed()voidonFileDelete(FileDeletionEvent event)Called upon a file deletion event.voidwrite(byte[] b)This method would block as necessary if running out of disk space.voidwrite(byte[] b, int off, int len)This method would block as necessary if running out of disk space.voidwrite(int b)This method would block as necessary if running out of disk space.
 
- 
- 
- 
Constructor Detail- 
MultiFileOutputStreampublic MultiFileOutputStream() Construct an instance to use the default temporary directory and temp file naming convention. Theinit(UploadObjectObserver, long, long)must be called before this stream is considered fully initialized.
 - 
MultiFileOutputStreampublic MultiFileOutputStream(File root, String namePrefix) Construct an instance to use the specified directory for temp file creations, and the specified prefix for temp file naming. Theinit(UploadObjectObserver, long, long)must be called before this stream is considered fully initialized.
 
- 
 - 
Method Detail- 
initpublic MultiFileOutputStream init(UploadObjectObserver observer, long partSize, long diskLimit) Used to initialize this stream. This method is an SPI (service provider interface) that is called fromS3EncryptionClient.Implementation of this method should never block. - Parameters:
- observer- the upload object observer
- partSize- part size for multipart upload
- diskLimit- the maximum disk space to be used for this multipart upload
- Returns:
- this object
 
 - 
writepublic void write(int b) throws IOExceptionThis method would block as necessary if running out of disk space.- Specified by:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
writepublic void write(byte[] b) throws IOExceptionThis method would block as necessary if running out of disk space.- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
writepublic void write(byte[] b, int off, int len) throws IOExceptionThis method would block as necessary if running out of disk space.- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
onFileDeletepublic void onFileDelete(FileDeletionEvent event) Description copied from interface:OnFileDeleteCalled upon a file deletion event.Implementation of this method should never block. - Specified by:
- onFileDeletein interface- OnFileDelete
- Parameters:
- event- file deletion event
 
 - 
flushpublic void flush() throws IOException- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- OutputStream
- Throws:
- IOException
 
 - 
cleanuppublic void cleanup() 
 - 
getNumFilesWrittenpublic int getNumFilesWritten() - Returns:
- the number of files written with the specified prefix with the part number as the file extension.
 
 - 
getFilepublic File getFile(int partNumber) 
 - 
getPartSizepublic long getPartSize() 
 - 
getRootpublic File getRoot() 
 - 
getNamePrefixpublic String getNamePrefix() 
 - 
getTotalBytesWrittenpublic long getTotalBytesWritten() 
 - 
isClosedpublic boolean isClosed() 
 - 
getDiskLimitpublic long getDiskLimit() 
 
- 
 
-