Class ResourceFile

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.io.File>

    public class ResourceFile
    extends java.io.File
    ResourceFile may be used to encapsulate files to be loaded from resources, i.e. from the build directory or from inside of a jar.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceFile​(ResourceFile baseFile, java.lang.String pathname)
      C'tor for instantiating a resource file relative to another resource file.
      ResourceFile​(java.lang.String pathname)
      C'tor for instantiating a resource file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      boolean exists()  
      java.io.InputStream getInputStream()
      Getter for an input stream to read this resource file.
      ResourceFile getParentFile()  
      java.lang.String getPath()  
      java.lang.String getPathName()
      Getter for the resource's path.
      int hashCode()  
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getTotalSpace, getUsableSpace, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ResourceFile

        public ResourceFile​(java.lang.String pathname)
        C'tor for instantiating a resource file.
        Parameters:
        pathname - The path to the resource
      • ResourceFile

        public ResourceFile​(ResourceFile baseFile,
                            java.lang.String pathname)
        C'tor for instantiating a resource file relative to another resource file.
        Parameters:
        baseFile - The base file to which the relative path is to be considered.
        pathname - The relative path to the resource with respect to the base file.
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
        Getter for an input stream to read this resource file.
        Returns:
        The input stream to read the contents of this resource file.
      • getPathName

        public final java.lang.String getPathName()
        Getter for the resource's path.
        Returns:
        The path of the resource file.
      • getPath

        public final java.lang.String getPath()
        Overrides:
        getPath in class java.io.File
      • getParentFile

        public final ResourceFile getParentFile()
        Overrides:
        getParentFile in class java.io.File
      • exists

        public boolean exists()
        Overrides:
        exists in class java.io.File
      • equals

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

        public int hashCode()
        Overrides:
        hashCode in class java.io.File