Class MoreFiles


  • @ParametersAreNonnullByDefault
    public final class MoreFiles
    extends Object
    Static utility methods related to Files.
    • Method Detail

      • fileExtension

        @Nonnull
        public static String fileExtension​(File file)
        Returns the file extension for the given file, or the empty string if the file has no extension. The result does not include the '.'.
        Parameters:
        file - the file
        Returns:
        the file extension
      • fileExtension

        @Nonnull
        public static String fileExtension​(String fullName)
        Returns the file extension for the given file name, or the empty string if the fullName has no extension. The result does not include the '.'.
        Parameters:
        fullName - the file name
        Returns:
        the fullName extension
      • nameWithoutExtension

        @Nonnull
        public static String nameWithoutExtension​(File file)
        Returns the file name without its file extension or path. This is similar to the basename unix command. The result does not include the '.'.
        Parameters:
        file - the file
        Returns:
        the file name without its extension
      • nameWithoutExtension

        @Nonnull
        public static String nameWithoutExtension​(String fullName)
        Returns the file name without its fullName extension or path. This is similar to the basename unix command. The result does not include the '.'.
        Parameters:
        fullName - the file name
        Returns:
        the fullName name without its extension