Package okio
Class DeflaterSink
- java.lang.Object
-
- okio.DeflaterSink
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,Sink
public final class DeflaterSink extends java.lang.Object implements Sink
A sink that uses DEFLATE to compress data written to another source.Sync flush
Aggressive flushing of this stream may result in reduced compression. Each call toflush()immediately compresses all currently-buffered data; this early compression may be less effective than compression performed without flushing.This is equivalent to using
Deflaterwith the sync flush option. This class does not offer any partial flush mechanism. For best performance, only callflush()when application behavior requires it.
-
-
Constructor Summary
Constructors Constructor Description DeflaterSink(Sink sink, java.util.zip.Deflater deflater)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Pushes all buffered bytes to their final destination and releases the resources held by this sink.voidflush()Pushes all buffered bytes to their final destination.Timeouttimeout()Returns the timeout for this sink.java.lang.StringtoString()voidwrite(Buffer source, long byteCount)RemovesbyteCountbytes fromsourceand appends them to this.
-
-
-
Constructor Detail
-
DeflaterSink
public DeflaterSink(Sink sink, java.util.zip.Deflater deflater)
-
-
Method Detail
-
write
public void write(Buffer source, long byteCount) throws java.io.IOException
Description copied from interface:SinkRemovesbyteCountbytes fromsourceand appends them to this.
-
flush
public void flush() throws java.io.IOExceptionDescription copied from interface:SinkPushes all buffered bytes to their final destination.
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:SinkPushes 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.
-
timeout
public Timeout timeout()
Description copied from interface:SinkReturns the timeout for this sink.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-