Class FileResource

    • Constructor Summary

      Constructors 
      Constructor Description
      FileResource​(java.io.File file)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getFile()  
      java.lang.String getFileName()
      Returns a decorative "file name" that can be used for reporting errors and the like.
      java.net.URL getLocation()  
      long lastModified()
      Returns the time of the last modification, in milliseconds since 1970, or 0L if the time of the last modification cannot be determined.
      java.io.InputStream open()
      Opens the resource.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • FileResource

        public FileResource​(java.io.File file)
    • Method Detail

      • getLocation

        public java.net.URL getLocation()
                                 throws java.io.IOException
        Specified by:
        getLocation in interface LocatableResource
        Returns:
        A locator that addresses this resource's contents
        Throws:
        java.io.IOException
      • getFileName

        public final java.lang.String getFileName()
        Description copied from interface: Resource
        Returns a decorative "file name" that can be used for reporting errors and the like. It does not necessarily map to a file in the local file system!
        Specified by:
        getFileName in interface Resource
      • open

        public final java.io.InputStream open()
                                       throws java.io.IOException
        Description copied from interface: Resource
        Opens the resource. The caller is responsible for closing the InputStream.
        Specified by:
        open in interface Resource
        Throws:
        java.io.IOException
      • lastModified

        public final long lastModified()
        Description copied from interface: Resource
        Returns the time of the last modification, in milliseconds since 1970, or 0L if the time of the last modification cannot be determined.
        Specified by:
        lastModified in interface Resource
      • getFile

        public final java.io.File getFile()
        Returns:
        The file containing the contents of this resource
      • toString

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