Class FilenameSplitExtension

Object
FilenameSplitExtension

public final class FilenameSplitExtension extends Object
A file-name with the base (without extension) split from the extension.

A period between the base and the extension exists in the filename, but this belongs to neither component.

Author:
Owen Feehan
  • Constructor Details

    • FilenameSplitExtension

      public FilenameSplitExtension(String pathWithoutExtension, Optional<String> extension)
      Creates from a path without an extension.
      Parameters:
      pathWithoutExtension - a path without an extension (any directory components are ignored)
      extension - the extension.
  • Method Details

    • combineWithSuffix

      public String combineWithSuffix(String suffix)
      Inserts a suffix after the base-name, but before the extension, immutably.
      Parameters:
      suffix - the suffix to insert
      Returns:
      the full filename with an extension inserted after the basename, but before the extension
    • getBaseName

      public String getBaseName()
      The part of the filename without an extension.
    • getExtension

      public Optional<String> getExtension()
      The extension of the filename.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object