All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bbn.bue.common.io.GZIPByteSink Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
package com.bbn.bue.common.io;

import com.google.common.io.ByteSink;

import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

import static com.google.common.base.Preconditions.checkNotNull;

public final class GZIPByteSink extends ByteSink {

  private GZIPByteSink(final ByteSink wrappedByteSink) {
    this.wrappedByteSink = checkNotNull(wrappedByteSink);
  }

  public static ByteSink gzipCompress(final ByteSink byteSink) {
    return new GZIPByteSink(byteSink);
  }

  @Override
  public OutputStream openStream() throws IOException {
    return new GZIPOutputStream(wrappedByteSink.openBufferedStream());
  }

  private final ByteSink wrappedByteSink;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy