Class WindowsPathType


  • final class WindowsPathType
    extends PathType
    Windows-style path type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern DRIVE_LETTER_ROOT
      Pattern for matching normal C:\ drive letter root syntax.
      (package private) static WindowsPathType INSTANCE
      Windows path type.
      private static java.util.regex.Pattern TRAILING_SPACES
      Pattern for matching trailing spaces in file names.
      private static java.util.regex.Pattern UNC_ROOT
      Pattern for matching UNC \\host\share root syntax.
      private static java.util.regex.Pattern WORKING_DIR_WITH_DRIVE
      Matches the C:foo\bar path format, which has a root (C:) and names (foo\bar) and matches a path relative to the working directory on that drive.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private WindowsPathType()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean isReserved​(char c)
      Checks if c is one of the reserved characters that aren't allowed in Windows file names.
      private @Nullable java.lang.String parseDriveRoot​(java.lang.String path)
      Parses a normal drive-letter root, e.g.
      PathType.ParseResult parsePath​(java.lang.String path)
      Parses the given strings as a path.
      private java.lang.String parseUncRoot​(java.lang.String path, java.lang.String original)
      Parse the root of a UNC-style path, throwing an exception if the path does not start with a valid UNC root.
      PathType.ParseResult parseUriPath​(java.lang.String uriPath)
      Parses a path from the given URI path.
      java.lang.String toString​(@Nullable java.lang.String root, java.lang.Iterable<java.lang.String> names)
      Returns the string form of the given path.
      java.lang.String toUriPath​(java.lang.String root, java.lang.Iterable<java.lang.String> names, boolean directory)
      Returns the string form of the given path for use in the path part of a URI.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • WORKING_DIR_WITH_DRIVE

        private static final java.util.regex.Pattern WORKING_DIR_WITH_DRIVE
        Matches the C:foo\bar path format, which has a root (C:) and names (foo\bar) and matches a path relative to the working directory on that drive. Currently can't support that format as it requires behavior that differs completely from Unix.
      • TRAILING_SPACES

        private static final java.util.regex.Pattern TRAILING_SPACES
        Pattern for matching trailing spaces in file names.
      • UNC_ROOT

        private static final java.util.regex.Pattern UNC_ROOT
        Pattern for matching UNC \\host\share root syntax.
      • DRIVE_LETTER_ROOT

        private static final java.util.regex.Pattern DRIVE_LETTER_ROOT
        Pattern for matching normal C:\ drive letter root syntax.
    • Constructor Detail

      • WindowsPathType

        private WindowsPathType()
    • Method Detail

      • parseUncRoot

        private java.lang.String parseUncRoot​(java.lang.String path,
                                              java.lang.String original)
        Parse the root of a UNC-style path, throwing an exception if the path does not start with a valid UNC root.
      • parseDriveRoot

        private @Nullable java.lang.String parseDriveRoot​(java.lang.String path)
        Parses a normal drive-letter root, e.g. "C:\".
      • isReserved

        private static boolean isReserved​(char c)
        Checks if c is one of the reserved characters that aren't allowed in Windows file names.
      • toString

        public java.lang.String toString​(@Nullable java.lang.String root,
                                         java.lang.Iterable<java.lang.String> names)
        Description copied from class: PathType
        Returns the string form of the given path.
        Specified by:
        toString in class PathType
      • toUriPath

        public java.lang.String toUriPath​(java.lang.String root,
                                          java.lang.Iterable<java.lang.String> names,
                                          boolean directory)
        Description copied from class: PathType
        Returns the string form of the given path for use in the path part of a URI. The root element is not nullable as the path must be absolute. The elements of the returned path do not need to be escaped. The directory boolean indicates whether the file the URI is for is known to be a directory.
        Specified by:
        toUriPath in class PathType