Package org.brotli.integration
Class BundleHelper
java.lang.Object
org.brotli.integration.BundleHelper
Utilities to work test files bundles in zip archive.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
fingerprintStream
(InputStream input) Calculates CRC64 of stream contents.static long
getExpectedFingerprint
(String entryName) listEntries
(InputStream input) static byte[]
readEntry
(InputStream input, String entryName) static byte[]
readStream
(InputStream input) static long
updateCrc64
(long crc, byte[] data, int offset, int length) Rolls CRC64 calculation.
-
Field Details
-
CRC_64_POLY
private static final long CRC_64_POLYECMA CRC64 polynomial.
-
-
Constructor Details
-
BundleHelper
private BundleHelper()
-
-
Method Details
-
listEntries
- Throws:
IOException
-
readStream
- Throws:
IOException
-
readEntry
- Throws:
IOException
-
updateCrc64
public static long updateCrc64(long crc, byte[] data, int offset, int length) Rolls CRC64 calculation.CRC64(data) = -1 ^ updateCrc64((... updateCrc64(-1, firstBlock), ...), lastBlock);
This simple and reliable checksum is chosen to make is easy to calculate the same value across the variety of languages (C++, Java, Go, ...).
-
fingerprintStream
Calculates CRC64 of stream contents.- Throws:
IOException
-
getExpectedFingerprint
-