How to check whether file is gzip or not in java. I checked by reading first 2 bytes and comparing with magic code. But for large size of file getting OutOfMemoryError.
Any one knows other way to do this?
This is the code I am using:
def isGzipCompressionFile(File file)
{
return ((file.bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (file.bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8)))
}