Class MultiFileOutputStream

    • Constructor Detail

      • MultiFileOutputStream

        public MultiFileOutputStream()
        Construct an instance to use the default temporary directory and temp file naming convention. The init(UploadObjectObserver, long, long) must be called before this stream is considered fully initialized.
      • MultiFileOutputStream

        public 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. The init(UploadObjectObserver, long, long) must be called before this stream is considered fully initialized.
    • Method Detail

      • init

        public MultiFileOutputStream init​(UploadObjectObserver observer,
                                          long partSize,
                                          long diskLimit)
        Used to initialize this stream. This method is an SPI (service provider interface) that is called from S3EncryptionClient.

        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
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws IOException
        This method would block as necessary if running out of disk space.
        Overrides:
        write in class OutputStream
        Throws:
        IOException
      • onFileDelete

        public void onFileDelete​(FileDeletionEvent event)
        Description copied from interface: OnFileDelete
        Called upon a file deletion event.

        Implementation of this method should never block.

        Specified by:
        onFileDelete in interface OnFileDelete
        Parameters:
        event - file deletion event
      • cleanup

        public void cleanup()
      • getNumFilesWritten

        public int getNumFilesWritten()
        Returns:
        the number of files written with the specified prefix with the part number as the file extension.
      • getFile

        public File getFile​(int partNumber)
      • getPartSize

        public long getPartSize()
      • getRoot

        public File getRoot()
      • getNamePrefix

        public String getNamePrefix()
      • getTotalBytesWritten

        public long getTotalBytesWritten()
      • isClosed

        public boolean isClosed()
      • getDiskLimit

        public long getDiskLimit()