Class MeteredOutputStream

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

    public class MeteredOutputStream
    extends java.io.FilterOutputStream
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      MeteredOutputStream​(java.io.OutputStream out)
      Creates an output stream filter built on top of the specified underlying output stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getBytesWritten()  
      void write​(byte[] b)
      Writes b.length bytes to this output stream.
      void write​(byte[] b, int off, int len)
      Writes len bytes from the specified byte array starting at offset off to this output stream.
      void write​(int b)
      Writes the specified byte to this output stream.
      • Methods inherited from class java.io.FilterOutputStream

        close, flush
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

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

      • MeteredOutputStream

        public MeteredOutputStream​(@Nonnull
                                   java.io.OutputStream out)
        Creates an output stream filter built on top of the specified underlying output stream.
        Parameters:
        out - the underlying output stream.
    • Method Detail

      • getBytesWritten

        public long getBytesWritten()
      • write

        public void write​(int b)
                   throws java.io.IOException
        Writes the specified byte to this output stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Parameters:
        b - the byte.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • write

        public void write​(@Nonnull
                          byte[] b)
                   throws java.io.IOException
        Writes b.length bytes to this output stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Parameters:
        b - the data to be written.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • write

        public void write​(@Nonnull
                          byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Writes len bytes from the specified byte array starting at offset off to this output stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Parameters:
        b - the data.
        off - the start offset in the data.
        len - the number of bytes to write.
        Throws:
        java.io.IOException - if an I/O error occurs.