
com.iprogrammerr.bright.server.binary.processed.GzipCompressedBinary Maven / Gradle / Ivy
package com.iprogrammerr.bright.server.binary.processed;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.util.zip.GZIPOutputStream;
public final class GzipCompressedBinary implements CompressedBinary {
private final byte[] source;
public GzipCompressedBinary(byte[] source) {
this.source = source;
}
@Override
public byte[] content() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(this.source.length);
GZIPOutputStream gos = new GZIPOutputStream(new BufferedOutputStream(baos));
gos.write(this.source);
gos.close();
return baos.toByteArray();
}
@Override
public String algorithm() {
return "gzip";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy