1package com.runehive.fs.util;
3import com.runehive.fs.cache.FileSystem;
4import org.apache.tools.bzip2.CBZip2InputStream;
6import java.io.ByteArrayInputStream;
7import java.io.IOException;
8import java.util.zip.GZIPInputStream;
10import static com.google.common.io.ByteStreams.toByteArray;
25 public static byte[]
gunzip(
byte[] data)
throws IOException {
26 return toByteArray(
new GZIPInputStream(
new ByteArrayInputStream(data)));
44 public static byte[]
unbzip2Headerless(
byte[] data,
int offset,
int length)
throws IOException {
46 byte[] bzip2 =
new byte[length + 2];
49 System.arraycopy(data, offset, bzip2, 2, length);
61 public static byte[]
unbzip2(
byte[] data)
throws IOException {
62 return toByteArray(
new CBZip2InputStream(
new ByteArrayInputStream(data)));
72 throw new UnsupportedOperationException(
"static-utility classes may not be instantiated.");
CompressionUtil()
Suppresses the default-public constructor preventing this class from being instantiated by other clas...
static byte[] gunzip(byte[] data)
Uncompresses a byte array of g-zipped data.
static byte[] unbzip2(byte[] data)
Uncompresses a byte array of b-zipped data.
static byte[] unbzip2Headerless(byte[] data, int offset, int length)
Uncompresses a byte array of b-zipped data that does not contain a header.