Class Location


  • public class Location
    extends java.lang.Object
    Wrapper for a file system directory; can create filenames in that directory. Enforces some simple consistency policies and provides a "typed string" for a filename to reduce errors.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String absolute​(java.lang.String filename)
      Return an absolute filename where relative names are resolved from the location
      java.lang.String absolute​(java.lang.String filename, java.lang.String extension)
      Return an absolute filename where relative names are resolved from the location
      static Location create​(java.lang.String directoryName)
      Return a location for a directory on disk
      static Location create​(java.nio.file.Path directoryName)
      Return a location for a directory on disk
      boolean equals​(java.lang.Object obj)  
      boolean exists()
      Does the location exist (and it a directory, and is accessible)
      boolean exists​(java.lang.String filename)  
      boolean exists​(java.lang.String filename, java.lang.String ext)  
      java.lang.String getDirectoryPath()  
      MetaFile getMetaFile()  
      java.lang.String getPath​(java.lang.String filename)
      Return the name of the file relative to this location
      java.lang.String getPath​(java.lang.String filename, java.lang.String ext)
      Return the name of the file, and extension, relative to this location
      java.lang.String getSubDirectory​(java.lang.String dirname)  
      Location getSubLocation​(java.lang.String dirname)  
      int hashCode()  
      boolean isMem()  
      boolean isMemUnique()  
      static Location mem()
      Return a fresh memory location : always unique, never .equals to another location.
      static Location mem​(java.lang.String name)
      Return a memory location with a name
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • mem

        public static Location mem()
        Return a fresh memory location : always unique, never .equals to another location.
      • mem

        public static Location mem​(java.lang.String name)
        Return a memory location with a name
      • create

        public static Location create​(java.lang.String directoryName)
        Return a location for a directory on disk
      • create

        public static Location create​(java.nio.file.Path directoryName)
        Return a location for a directory on disk
      • getDirectoryPath

        public java.lang.String getDirectoryPath()
      • getMetaFile

        public MetaFile getMetaFile()
      • isMem

        public boolean isMem()
      • isMemUnique

        public boolean isMemUnique()
      • getSubLocation

        public Location getSubLocation​(java.lang.String dirname)
      • getSubDirectory

        public java.lang.String getSubDirectory​(java.lang.String dirname)
      • absolute

        public java.lang.String absolute​(java.lang.String filename,
                                         java.lang.String extension)
        Return an absolute filename where relative names are resolved from the location
      • absolute

        public java.lang.String absolute​(java.lang.String filename)
        Return an absolute filename where relative names are resolved from the location
      • exists

        public boolean exists()
        Does the location exist (and it a directory, and is accessible)
      • exists

        public boolean exists​(java.lang.String filename)
      • exists

        public boolean exists​(java.lang.String filename,
                              java.lang.String ext)
      • getPath

        public java.lang.String getPath​(java.lang.String filename)
        Return the name of the file relative to this location
      • getPath

        public java.lang.String getPath​(java.lang.String filename,
                                        java.lang.String ext)
        Return the name of the file, and extension, relative to this location
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object