Get the file name without the .gz extension

@param fname The name of the gzip file

@return fname without the ".gz" extension

@throws IAE if fname is not a valid "*.gz" file name
195553
public static String getGzBaseName(String fname)
  {
    final String reducedFname = Files.getNameWithoutExtension(fname);
    if (isGz(fname) && !reducedFname.isEmpty()) {
      return reducedFname;
    }
    throw new IAE("[%s] is not a valid gz file name", fname);
  }
1121934
public static String cleanFilename(String fileName){
        int lastIndex = fileName.lastIndexOf(".");
        return fileName.substring(0, lastIndex);
    }
1159485
public static String getExtension(String fileName){
        int dot = fileName.lastIndexOf('.');
        return dot==-1 ? null : fileName.substring(dot+1);
    }
1211246
public static String makeSafeFilename(String filename) {
        // Replace invalid characters
        for (final Map.Entry<Pattern, String> pair : REPLACEMENT_PAIRS.entrySet()) {
            final Pattern pattern = pair.getKey();
            final Matcher matcher = pattern.matcher(filename);
            filename = matcher.replaceAll(pair.getValue());
        }

        // Make sure the name doesn't violate a Windows reserved word...
        for (Pattern pattern : WINDOWS_INVALID_PATTERNS) {
            if (pattern.matcher(filename).matches()) {
                filename = "uP-" + filename;
                break;
            }
        }

        return filename;
    }
253228
@Pure
	public static String extension(File filename) {
		if (filename == null) {
			return null;
		}
		final String largeBasename = largeBasename(filename);
		final int idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
		if (idx <= 0) {
			return ""; //$NON-NLS-1$
		}
		return largeBasename.substring(idx);
	}
635202
@Nullable
    public static String getFileExtension(@NotNull String fileName) {
        @Nullable
        final String fileExt = FilenameUtils.getExtension(fileName);
        return StringUtils.isNoneEmpty(fileExt) ? StringUtils.lowerCase(fileExt) : null;
    }
492873
def __gzip(filename):
		
		zipname = filename + '.gz'
		file_pointer = open(filename,'rb')
		zip_pointer = gzip.open(zipname,'wb')
		zip_pointer.writelines(file_pointer)
		file_pointer.close()
		zip_pointer.close()
		return zipname
992018
function getNameFromFileName(filename) {
  var file = basename(filename).replace(/\.(?:pug|jade)$/, '');
  return file.toLowerCase().replace(/[^a-z0-9]+([a-z])/g, function (_, character) {
    return character.toUpperCase();
  }) + 'Template';
}
1124837
function getFilenameWithoutExtension(filename) {
        var index = filename.lastIndexOf(".");
        return index === -1 ? filename : filename.slice(0, index);
    }
1033309
private String getExtension(String fileName) {
		if (fileName == null) {
            return null;
        }

		String ext = null;
		int i = fileName.lastIndexOf('.');

		if (i > 0 && i < fileName.length() - 1) {
			ext = fileName.substring(i + 1).toLowerCase();
		}
		return ext;
	}
541495
private static String nameOnly(final String filename) {
        final int p = filename.lastIndexOf('.');
        if (p == -1) {
            return filename;
        }
        return filename.substring(0, p);
    }
1073242
public static InputStream getFileInputStream(String filename) throws IOException {
    InputStream in = new FileInputStream(filename);
    if (filename.endsWith(".gz")) {
      in = new GZIPInputStream(in);
    } else if (filename.endsWith(".bz2")) {
      //in = new CBZip2InputStream(in);
      in = getBZip2PipedInputStream(filename);
    }
    return in;
  }
290432
public static String getSafeFilename(String filename)
   {
      String result = filename;
      if (result != null)
      {
         result = result.replaceAll("[^a-zA-Z0-9]+", "-").replaceAll("^-+", "");
      }
      return result;
   }
1081854
def __getFilenameSuffix(self, filename):
        """"""
        if filename and isinstance(filename, string_types):
            if self.__isValidTGZ(filename):
                return ".tar.gz"
            elif filename.endswith(".zip"):
                return ".zip"
1287266
public static boolean isGz(String fName)
  {
    if (Strings.isNullOrEmpty(fName)) {
      return false;
    }
    return fName.endsWith(GZ_SUFFIX) && fName.length() > GZ_SUFFIX.length();
  }
77513
public boolean fnameExists(final String fname) {
        boolean rslt = false; // default
        try {
            final ITenant tenant = getTenantByFName(fname);
            rslt = tenant != null;
        } catch (IllegalArgumentException iae) {
            // This exception is completely fine;  it simply
            // means there is no tenant with this fname.
            rslt = false;
        }
        return rslt;
    }
239143
public static String getName(String fileName){
        int dot = fileName.lastIndexOf('.');
        return dot==-1 ? fileName : fileName.substring(0, dot);
    }