List of utility methods to do GZip File Check
boolean | isGZipped(final File f) is G Zipped return isGZipped(new FileInputStream(f)); |
boolean | isGzipped(final File file) Checks if the file is gzipped. int magic = 0; final RandomAccessFile raf = new RandomAccessFile(file, "r"); magic = raf.read() & 0xff | ((raf.read() << 8) & 0xff00); raf.close(); return magic == GZIPInputStream.GZIP_MAGIC; |
boolean | isGZipped(final File file) is G Zipped int magic = 0; try { RandomAccessFile raf = new RandomAccessFile(file, "r"); magic = raf.read() & 0xff | raf.read() << 8 & 0xff00; raf.close(); } catch (Throwable e) { e.printStackTrace(System.err); return magic == GZIPInputStream.GZIP_MAGIC; |
boolean | isGzipped(String fileName) Tests if a file has been compressed using gzip. return isGzipped(new File(fileName)); |
boolean | isGZipped(String name) Returns true if file is in GZip format and false if it is not. int n = 0; File file = null; RandomAccessFile raf = null; try { try { file = new File(name); if (!file.exists()) { return false; ... |