src/main/java/org/apache/hadoop/hdfs/server/namenode/queries/FileTypeHistogram.java
public static String determineType(String name) {
    String key;
    if ((key = equalsMap.get(name)) != null) {
      return key;
    } else if (name.length() > 6 && (key = startsWithMap.get(name.substring(0, 6))) != null) {
      return key;
    } else if (name.length() > 10 && (key = startsWithMap.get(name.substring(0, 10))) != null) {
      return key;
    } else {
      int extIndex = name.lastIndexOf(".");
      if (extIndex != -1 && (key = suffixExtMap.get(name.substring(extIndex))) != null) {
        return key;
      }
      extIndex = name.lastIndexOf("_");
      if (extIndex != -1 && (key = suffixExtMap.get(name.substring(extIndex))) != null) {
        return key;
      }
    }
    return Types.UNKNOWN.name();
  }
/**
   * Method for determining the file type based on the file name.
   *
   * @param name the name of the file
   * @return the type of the file
   */
Method for determining the file type based on the file name.
@param name the name of the file
@return the type of the file
Method for determining the file type based on the file name . @param name the name of the file @return the type of the file
public static String determineType(String name) {
    String key;
    if ((key = equalsMap.get(name)) != null) {
      return key;
    } else if (name.length() > 6 && (key = startsWithMap.get(name.substring(0, 6))) != null) {
      return key;
    } else if (name.length() > 10 && (key = startsWithMap.get(name.substring(0, 10))) != null) {
      return key;
    } else {
      int extIndex = name.lastIndexOf(".");
      if (extIndex != -1 && (key = suffixExtMap.get(name.substring(extIndex))) != null) {
        return key;
      }
      extIndex = name.lastIndexOf("_");
      if (extIndex != -1 && (key = suffixExtMap.get(name.substring(extIndex))) != null) {
        return key;
      }
    }
    return Types.UNKNOWN.name();
  }
public static String determineType ( String name ) { String key ; if ( ( key = equalsMap . get ( name ) ) != null ) { return key ; } else if ( name . length ( ) > 6 && ( key = startsWithMap . get ( name . substring ( 0 , 6 ) ) ) != null ) { return key ; } else if ( name . length ( ) > 10 && ( key = startsWithMap . get ( name . substring ( 0 , 10 ) ) ) != null ) { return key ; } else { int extIndex = name . lastIndexOf ( "." ) ; if ( extIndex != - 1 && ( key = suffixExtMap . get ( name . substring ( extIndex ) ) ) != null ) { return key ; } extIndex = name . lastIndexOf ( "_" ) ; if ( extIndex != - 1 && ( key = suffixExtMap . get ( name . substring ( extIndex ) ) ) != null ) { return key ; } } return Types . UNKNOWN . name ( ) ; }
Method for determining the file type based on the file name.
Method for determining the file type based on the file name .