Package okio
Class ForwardingSink
- java.lang.Object
-
- okio.ForwardingSink
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,Sink
- Direct Known Subclasses:
HashingSink
public abstract class ForwardingSink extends Object implements Sink
ASink
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.String
toString()
void
write(Buffer source, long byteCount)
RemovesbyteCount
bytes fromsource
and appends them to this.
-
-
-
Constructor Detail
-
ForwardingSink
public ForwardingSink(Sink delegate)
-
-
Method Detail
-
write
public void write(Buffer source, long byteCount) throws IOException
Description copied from interface:Sink
RemovesbyteCount
bytes fromsource
and appends them to this.- Specified by:
write
in interfaceSink
- Throws:
IOException
-
flush
public void flush() throws IOException
Description copied from interface:Sink
Pushes all buffered bytes to their final destination.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceSink
- Throws:
IOException
-
timeout
public Timeout timeout()
Description copied from interface:Sink
Returns the timeout for this sink.
-
close
public void close() throws 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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSink
- Throws:
IOException
-
-