public class MultiFileOutputStream extends java.io.OutputStream implements OnFileDelete
Constructor and Description |
---|
MultiFileOutputStream()
Construct an instance to use the default temporary directory and temp
file naming convention.
|
MultiFileOutputStream(java.io.File root,
java.lang.String namePrefix)
Construct an instance to use the specified directory for temp file
creations, and the specified prefix for temp file naming.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Deletes files.
|
void |
close() |
void |
flush() |
long |
getDiskLimit() |
java.io.File |
getFile(int partNumber)
Retrieves the file with the specified part number as the file extension.
|
java.lang.String |
getNamePrefix() |
int |
getNumFilesWritten() |
long |
getPartSize() |
java.io.File |
getRoot() |
long |
getTotalBytesWritten() |
MultiFileOutputStream |
init(UploadObjectObserver observer,
long partSize,
long diskLimit)
Used to initialized this stream.
|
boolean |
isClosed() |
void |
onFileDelete(FileDeletionEvent event)
Called upon a file deletion event.
|
void |
write(byte[] b)
This method would block as necessary if running out of disk space.
|
void |
write(byte[] b,
int off,
int len)
This method would block as necessary if running out of disk space.
|
void |
write(int b)
This method would block as necessary if running out of disk space.
|
public MultiFileOutputStream()
init(UploadObjectObserver, long, long)
must be called before
this stream is considered fully initialized.public MultiFileOutputStream(java.io.File root, java.lang.String namePrefix)
init(UploadObjectObserver, long, long)
must be called before
this stream is considered fully initialized.namePrefix
- the prefix for file naming.root
- the file foot.public MultiFileOutputStream init(UploadObjectObserver observer, long partSize, long diskLimit)
AmazonS3EncryptionClient
.
Implementation of this method should never block.
observer
- the upload object observerpartSize
- part size for multi-part uploaddiskLimit
- the maximum disk space to be used for this multi-part uploadpublic void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void onFileDelete(FileDeletionEvent event)
OnFileDelete
Implementation of this method should never block.
onFileDelete
in interface OnFileDelete
event
- file deletion eventpublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void cleanup()
public int getNumFilesWritten()
public java.io.File getFile(int partNumber)
partNumber
- the file extension.public long getPartSize()
public java.io.File getRoot()
public java.lang.String getNamePrefix()
public long getTotalBytesWritten()
public boolean isClosed()
public long getDiskLimit()