A static-utility class containing containing extension or helper methods for compressor-deccompressor's.
More...
|
| static byte[] | gunzip (byte[] data) throws IOException |
| | Uncompresses a byte array of g-zipped data.
|
| static byte[] | unbzip2 (byte[] data) throws IOException |
| | Uncompresses a byte array of b-zipped data.
|
| static byte[] | unbzip2Headerless (byte[] data, int offset, int length) throws IOException |
| | Uncompresses a byte array of b-zipped data that does not contain a header.
|
|
| | CompressionUtil () |
| | Suppresses the default-public constructor preventing this class from being instantiated by other classes.
|
A static-utility class containing containing extension or helper methods for compressor-deccompressor's.
- Author
- Ryley Kimmel ryley.nosp@m..kim.nosp@m.mel@l.nosp@m.ive..nosp@m.com
Definition at line 17 of file CompressionUtil.java.
◆ CompressionUtil()
| com.runehive.fs.util.CompressionUtil.CompressionUtil |
( |
| ) |
|
|
private |
Suppresses the default-public constructor preventing this class from being instantiated by other classes.
- Exceptions
-
| UnsupportedOperationException | If this class is instantiated within itself. |
Definition at line 71 of file CompressionUtil.java.
71 {
72 throw new UnsupportedOperationException("static-utility classes may not be instantiated.");
73 }
◆ gunzip()
| byte[] com.runehive.fs.util.CompressionUtil.gunzip |
( |
byte[] | data | ) |
throws IOException |
|
static |
Uncompresses a byte array of g-zipped data.
- Parameters
-
| data | The compressed, g-zipped data. |
- Returns
- The uncompressed data.
- Exceptions
-
| IOException | If some I/O exception occurs. |
Definition at line 25 of file CompressionUtil.java.
25 {
26 return toByteArray(new GZIPInputStream(new ByteArrayInputStream(data)));
27 }
Referenced by com.runehive.fs.cache.decoder.RegionDecoder.load().
◆ unbzip2()
| byte[] com.runehive.fs.util.CompressionUtil.unbzip2 |
( |
byte[] | data | ) |
throws IOException |
|
static |
Uncompresses a byte array of b-zipped data.
- Parameters
-
| data | The compressed, b-zipped data. |
- Returns
- The uncompressed data.
- Exceptions
-
| IOException | If some I/O exception occurs. |
Definition at line 61 of file CompressionUtil.java.
61 {
62 return toByteArray(new CBZip2InputStream(new ByteArrayInputStream(data)));
63 }
Referenced by unbzip2Headerless().
◆ unbzip2Headerless()
| byte[] com.runehive.fs.util.CompressionUtil.unbzip2Headerless |
( |
byte[] | data, |
|
|
int | offset, |
|
|
int | length ) throws IOException |
|
static |
Uncompresses a byte array of b-zipped data that does not contain a header.
A b-zip header block consists of 2 bytes, they are replaced with 'h' and '1' as that is what our file
system compresses the header as.
- Parameters
-
| data | The compressed, b-zipped data. |
| offset | The offset position of the data. |
| length | The length of the data. |
- Returns
- The uncompressed data.
- Exceptions
-
| IOException | If some I/O exception occurs. |
Definition at line 44 of file CompressionUtil.java.
44 {
45
46 byte[] bzip2 = new byte[length + 2];
47 bzip2[0] = 'h';
48 bzip2[1] = '1';
49 System.arraycopy(data, offset, bzip2, 2, length);
50
51
52 return unbzip2(bzip2);
53 }
References unbzip2().
Referenced by com.runehive.fs.cache.archive.Archive.decode().
The documentation for this class was generated from the following file: