List of utility methods to do GZip Byte Array Check
boolean | isGzip(byte[] bytes) is Gzip return (bytes != null && bytes.length > 2 && bytes[0] == (byte) 0x1F && bytes[1] == (byte) 0x8B); |
boolean | isGZipped(byte[] bytes) is G Zipped if ((bytes == null) || (bytes.length < 2)) { return false; } else { return ((bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8))); |
boolean | isGzipped(byte[] data) Determines if the data contained in the buffer is gzipped by matching the first 2 bytes with GZIP magic GZIP_MAGIC (0x8b1f). if (data == null || data.length < 2) { return false; int byte1 = data[0]; int byte2 = data[1] & 0xff; return (byte1 | (byte2 << 8)) == GZIPInputStream.GZIP_MAGIC; |