Package okio

Class ForwardingSink

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, Sink
    Direct Known Subclasses:
    HashingSink

    public abstract class ForwardingSink
    extends java.lang.Object
    implements Sink
    A Sink which forwards calls to another. Useful for subclassing.
    • Constructor Summary

      Constructors 
      Constructor Description
      ForwardingSink​(Sink delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Pushes all buffered bytes to their final destination and releases the resources held by this sink.
      Sink delegate()
      Sink to which this instance is delegating.
      void flush()
      Pushes all buffered bytes to their final destination.
      Timeout timeout()
      Returns the timeout for this sink.
      java.lang.String toString()  
      void write​(Buffer source, long byteCount)
      Removes byteCount bytes from source and appends them to this.
      • Methods inherited from class java.lang.Object

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

      • ForwardingSink

        public ForwardingSink​(Sink delegate)
    • Method Detail

      • delegate

        public final Sink delegate()
        Sink to which this instance is delegating.
      • write

        public void write​(Buffer source,
                          long byteCount)
                   throws java.io.IOException
        Description copied from interface: Sink
        Removes byteCount bytes from source and appends them to this.
        Specified by:
        write in interface Sink
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Description copied from interface: Sink
        Pushes all buffered bytes to their final destination.
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in interface Sink
        Throws:
        java.io.IOException
      • timeout

        public Timeout timeout()
        Description copied from interface: Sink
        Returns the timeout for this sink.
        Specified by:
        timeout in interface Sink
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: Sink
        Pushes all buffered bytes to their final destination and releases the resources held by this sink. It is an error to write a closed sink. It is safe to close a sink more than once.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface Sink
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object