Interface ResourceReference

All Known Implementing Classes:
FileResourceReference, URLResourceReference, Utf8TextResource

public interface ResourceReference
A reference to a Resource that is identified by a property value
  • Method Details

    • asFile

      File asFile()
      Returns:
      a file representation of the resource, or null if the Resource cannot be represented as a File
    • asURL

      URL asURL()
      Returns:
      a URL representation of the resource, or null if the Resource cannot be represented as a URL
    • read

      InputStream read() throws IOException
      Returns:
      an InputStream to read the contents of the resource
      Throws:
      IOException - if unable to obtain an InputStream from the resource
    • isAccessible

      boolean isAccessible()
      Indicates whether or not the resource is accessible. What it means for the resource to be accessible depends on the type of resource. A File resource, for example, might be accessible only if the file exists and is readable, while a URL resource might always be considered accessible, or might be accesssible only if the existence of the resource can be confirmed.
      Returns:
      true if the file can be accessed, false otherwise
    • getLocation

      String getLocation()
      Returns:
      a String representation of the location, or null for a Resource that does not have an external location. For a File or a Directory, this will be the full path name; for a URL it will be the String form of the URL
    • getResourceType

      ResourceType getResourceType()
      Returns:
      the type of resource that is being referenced