Search in sources :

Example 6 with GzipSink

use of okio.GzipSink in project okhttp by square.

the class HttpOverHttp2Test method gzip.

public Buffer gzip(String bytes) throws IOException {
    Buffer bytesOut = new Buffer();
    BufferedSink sink = Okio.buffer(new GzipSink(bytesOut));
    sink.writeUtf8(bytes);
    sink.close();
    return bytesOut;
}
Also used : Buffer(okio.Buffer) GzipSink(okio.GzipSink) BufferedSink(okio.BufferedSink)

Example 7 with GzipSink

use of okio.GzipSink in project okhttp by square.

the class Http2Test method gzip.

private static Buffer gzip(byte[] data) throws IOException {
    Buffer buffer = new Buffer();
    Okio.buffer(new GzipSink(buffer)).write(data).close();
    return buffer;
}
Also used : Buffer(okio.Buffer) GzipSink(okio.GzipSink)

Example 8 with GzipSink

use of okio.GzipSink in project okhttp by square.

the class URLConnectionTest method gzip.

/** Returns a gzipped copy of {@code bytes}. */
public Buffer gzip(String data) throws IOException {
    Buffer result = new Buffer();
    BufferedSink gzipSink = Okio.buffer(new GzipSink(result));
    gzipSink.writeUtf8(data);
    gzipSink.close();
    return result;
}
Also used : Buffer(okio.Buffer) GzipSink(okio.GzipSink) BufferedSink(okio.BufferedSink)

Example 9 with GzipSink

use of okio.GzipSink in project okhttp by square.

the class CallTest method gzip.

private Buffer gzip(String data) throws IOException {
    Buffer result = new Buffer();
    BufferedSink sink = Okio.buffer(new GzipSink(result));
    sink.writeUtf8(data);
    sink.close();
    return result;
}
Also used : Buffer(okio.Buffer) GzipSink(okio.GzipSink) BufferedSink(okio.BufferedSink)

Example 10 with GzipSink

use of okio.GzipSink in project okhttp by square.

the class UrlConnectionCacheTest method gzip.

/** Returns a gzipped copy of {@code bytes}. */
public Buffer gzip(String data) throws IOException {
    Buffer result = new Buffer();
    BufferedSink sink = Okio.buffer(new GzipSink(result));
    sink.writeUtf8(data);
    sink.close();
    return result;
}
Also used : Buffer(okio.Buffer) GzipSink(okio.GzipSink) BufferedSink(okio.BufferedSink)

Aggregations

GzipSink (okio.GzipSink)14 Buffer (okio.Buffer)12 BufferedSink (okio.BufferedSink)9 ByteString (okio.ByteString)2 File (java.io.File)1 TreeSet (java.util.TreeSet)1 OkHttpClient (okhttp3.OkHttpClient)1 Request (okhttp3.Request)1 RequestBody (okhttp3.RequestBody)1 Response (okhttp3.Response)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 BufferedSource (okio.BufferedSource)1 Sink (okio.Sink)1 Test (org.junit.Test)1