Class ThresholdStorageProvider.ThresholdStorageOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    ThresholdStorageProvider

    private final class ThresholdStorageProvider.ThresholdStorageOutputStream
    extends StorageOutputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this output stream.
      protected Storage toStorage0()
      Has to be implemented by a concrete subclass to create a Storage object from the bytes that have been written to this StorageOutputStream.
      protected void write0​(byte[] buffer, int offset, int length)
      Has to implemented by a concrete subclass to write bytes from the given byte array to this StorageOutputStream.
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThresholdStorageOutputStream

        public ThresholdStorageOutputStream()
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: StorageOutputStream
        Closes this output stream. Subclasses that override this method have to invoke super.close().

        This implementation never throws an IOException but a subclass might.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class StorageOutputStream
        Throws:
        java.io.IOException - if an I/O error occurs.
      • write0

        protected void write0​(byte[] buffer,
                              int offset,
                              int length)
                       throws java.io.IOException
        Description copied from class: StorageOutputStream
        Has to implemented by a concrete subclass to write bytes from the given byte array to this StorageOutputStream. This method gets called by StorageOutputStream.write(int), StorageOutputStream.write(byte[]) and StorageOutputStream.write(byte[], int, int). All the required preconditions have already been checked by these methods, including the check if the output stream has already been closed.
        Specified by:
        write0 in class StorageOutputStream
        Parameters:
        buffer - buffer containing bytes to write.
        offset - start offset in the buffer.
        length - number of bytes to write.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • toStorage0

        protected Storage toStorage0()
                              throws java.io.IOException
        Description copied from class: StorageOutputStream
        Has to be implemented by a concrete subclass to create a Storage object from the bytes that have been written to this StorageOutputStream. This method gets called by StorageOutputStream.toStorage() after the preconditions have been checked. The implementation can also be sure that this methods gets invoked only once.
        Specified by:
        toStorage0 in class StorageOutputStream
        Returns:
        a Storage object as described above.
        Throws:
        java.io.IOException - if an I/O error occurs.