@Override
    public void writeTo(final OutputStream outStream) throws IOException {
        Args.notNull(outStream, "Output stream");
        final GZIPOutputStream gzip = new GZIPOutputStream(outStream);
        super.writeTo(gzip);
        // Only close output stream if the wrapped entity has been
        // successfully written out
        gzip.close();
    }
Wrapping entity that compresses content when {@link #writeTo writing}.


@since 4.0
httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java