Class Filenames.Extensions

java.lang.Object
com.globalmentor.io.Filenames.Extensions
Enclosing class:
Filenames

public static class Filenames.Extensions extends Object
Utilities for working directly with filename extensions themselves, separate from filenames.
Author:
Garret Wilson
  • Method Details

    • normalize

      public static String normalize(@Nonnull String extension)
      Normalizes an extension to its ASCII lowercase form. Non-ASCII characters are unchanged. Thus txt, TXT, and tXt will all return the normalized form txt.
      Parameters:
      extension - The extension to normalize.
      Returns:
      The normalized form of the extension.
    • equals

      public static boolean equals(@Nullable String extension1, @Nullable String extension2)
      Checks to see if two extensions are equal. Comparison is done on an ASCII case-insensitive basic. Thus txt, TXT, and tXt are all considered equal.
      API Note:
      This API follows Object.equals(Object) and String.equalsIgnoreCase(String) in allowing either or both arguments to be null.
      Implementation Specification:
      This implementation delegates to ASCII.equalsIgnoreCase(CharSequence, CharSequence).
      Parameters:
      extension1 - The first extension to compare.
      extension2 - The second extension to compare.
      Returns:
      true