List of utility methods to do GZip File Check
boolean | isGzip(File file) Gets if the file is compressed with gzip. try { RandomAccessFile raf = new RandomAccessFile(file, "r"); int magic = raf.read() & 0xff | (raf.read() << 8) & 0xff00; raf.close(); return magic == GZIPInputStream.GZIP_MAGIC; } catch (Exception e) { e.printStackTrace(); return false; |
boolean | isGzip(String file) is Gzip return isGzip(new File(file)); |
boolean | isGZipEnding(File file) is G Zip Ending return endsWith(file, ".gz"); |
boolean | isGzipFile(File f) is Gzip File FileInputStream fis = null; try { fis = new FileInputStream(f); GZIPInputStream gs = new GZIPInputStream(fis); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; ... |
boolean | isGZipFile(File file) is G Zip File boolean rv = false; if (file != null) { String fileName = file.getName(); if (fileName != null) { if (fileName.toLowerCase().endsWith(".gz")) { rv = true; return rv; |
boolean | isGzipFile(File file) Returns true if the input file is a gzip file. return hasCaseInsensitiveSuffix(file, gz_suffix) || hasCaseInsensitiveSuffix(file, tgz_suffix);
|
boolean | isGZIPFileEmpty(File f) is GZIP File Empty InputStream in = new GZIPInputStream(new FileInputStream(f)); try { return in.read() == -1; } finally { in.close(); |
boolean | isGzipFilename(File file) is Gzip Filename return isGzipFilename(file.getName());
|
boolean | isGzipped(File f) is Gzipped InputStream is = null; try { is = new FileInputStream(f); byte[] signature = new byte[2]; int nread = is.read(signature); return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b; } catch (IOException e) { return false; ... |
boolean | isGzipped(File file) Returns true if file has a .gz extension return file.getName().endsWith(".gz"); |