Interface UnixPath

All Superinterfaces:
Comparable<Path>, Iterable<Path>, Path, Watchable
All Known Implementing Classes:
ComponentUPath

public interface UnixPath extends Path
Platform-independent implementation of java.nio.file.Path allowing for consistency across Unix and Windows; useful for doing path transforms and as keys where it is imperative that the path separator be '/' no matter what. Has some caveats - particularly cannot be mixed with system path instances in a collection which will be sorted, because UnixPath assumes all paths are UnixPaths; may fail or do the wrong thing if passed directly to java.nio.Files. Used in particular as path keys in the JFS filesystem for NetBeans antlr support.

The behavior of instances retrieved from the factory methods should be identical with sun.nio.UnixPath, which is not public in the JDK.

Note the iterator will contain instances of UnixPath, though the API does not allow them to be typed as such.
Author:
Tim Boudreau
  • Method Details

    • empty

      static UnixPath empty()
    • emptyAbsolute

      static UnixPath emptyAbsolute()
    • get

      static UnixPath get(String name)
    • get

      static UnixPath get(String name, String... moreNames)
    • get

      static UnixPath get(Path path)
    • get

      static UnixPath get(Path first, Path... morePaths)
    • toRelativePath

      UnixPath toRelativePath()
    • toAbsolutePath

      UnixPath toAbsolutePath()
      Specified by:
      toAbsolutePath in interface Path
    • relativize

      UnixPath relativize(Path other)
      Specified by:
      relativize in interface Path
    • resolveSibling

      UnixPath resolveSibling(String other)
      Specified by:
      resolveSibling in interface Path
    • resolveSibling

      UnixPath resolveSibling(Path other)
      Specified by:
      resolveSibling in interface Path
    • resolve

      UnixPath resolve(String other)
      Specified by:
      resolve in interface Path
    • resolve

      UnixPath resolve(Path other)
      Specified by:
      resolve in interface Path
    • normalize

      UnixPath normalize()
      Specified by:
      normalize in interface Path
    • subpath

      UnixPath subpath(int beginIndex, int endIndex)
      Specified by:
      subpath in interface Path
    • getName

      UnixPath getName(int index)
      Specified by:
      getName in interface Path
    • getParent

      UnixPath getParent()
      Specified by:
      getParent in interface Path
    • getRoot

      UnixPath getRoot()
      Specified by:
      getRoot in interface Path
    • getFileName

      UnixPath getFileName()
      Specified by:
      getFileName in interface Path
    • toNativePath

      default Path toNativePath()
      Convert this path to the native equivalent retrieved from Paths.get() (if this involves Windows drive letters, all bets are off).
      Returns:
      A native path suitable for use with Files
    • isNormalized

      default boolean isNormalized()
      Determine if this path contains no "." or ".." elements.
      Returns:
      True if the path is normalized
    • visitNames

      default int visitNames(Consumer<String> consumer)
    • extension

      default String extension()
    • rawName

      default String rawName()
    • isExtension

      default boolean isExtension(String ext)
    • toString

      default String toString(char separator)
    • isEmpty

      default boolean isEmpty()
    • compareTo

      default int compareTo(Path other)
      Provides consistent, platform-indepenedent ordering: absolute is greater than non-absolute; greater name count is greater than lesser name count; if same name count, name elements are compared as case-sensitive strings.
      Specified by:
      compareTo in interface Comparable<Path>
      Specified by:
      compareTo in interface Path
      Parameters:
      other - The other path
      Returns: