Java GZip File Check isGzipFilename(File file)

Here you can find the source of isGzipFilename(File file)

Description

is Gzip Filename

License

Open Source License

Parameter

Parameter Description
file file to check

Return

true if has GZIP file extension

Declaration

public static boolean isGzipFilename(File file) 

Method Source Code

//package com.java2s;

import java.io.File;

import java.util.Locale;

public class Main {
    /**/*from  w  w w  .  ja  v a 2s  . c om*/
     * Name of the suffix used on compressed output files
     */
    public static final String GZ_SUFFIX = ".gz";

    /**
     * @param file file to check
     * @return true if has GZIP file extension
     */
    public static boolean isGzipFilename(File file) {
        return isGzipFilename(file.getName());
    }

    /**
     * @param file file to check
     * @return true if has GZIP file extension
     */
    public static boolean isGzipFilename(String file) {
        return file.toLowerCase(Locale.getDefault()).endsWith(GZ_SUFFIX);
    }
}

Related

  1. isGZipEnding(File file)
  2. isGzipFile(File f)
  3. isGZipFile(File file)
  4. isGzipFile(File file)
  5. isGZIPFileEmpty(File f)
  6. isGzipped(File f)
  7. isGzipped(File file)
  8. isGZipped(final File f)
  9. isGzipped(final File file)