Interface Resource

All Known Subinterfaces:
LocatableResource
All Known Implementing Classes:
FileResource, StringResource

public interface Resource
A sequence of bytes that is identified by a "name", is typically found by a ResourceFinder, can be open()ed for reading, and optionally has a lastModified() property.

There also exists a ResourceCreator concept which opens a resource for writing, but that happens directly and not through an intermediate Resource object.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a decorative "file name" that can be used for reporting errors and the like.
    long
    Returns the time of the last modification, in milliseconds since 1970, or 0L if the time of the last modification cannot be determined.
    Opens the resource.
  • Method Details

    • open

      InputStream open() throws IOException
      Opens the resource. The caller is responsible for closing the InputStream.
      Throws:
      IOException
    • getFileName

      String getFileName()
      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!
    • lastModified

      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.