Interface PlexusIoResource

All Superinterfaces:
ContentSupplier, FileInfo, NameSupplier, SizeSupplier
All Known Implementing Classes:
AbstractPlexusIoResource, PlexusIoFileResource, PlexusIoSymlinkResource, PlexusIoURLResource

public interface PlexusIoResource extends FileInfo, SizeSupplier, ContentSupplier
A resource is a file-like entity. It may be an actual file, an URL, a zip entry, or something like that.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Unknown modification date
    static final long
    Unknown resource size.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates an InputStream, which may be used to read the files contents.
    long
    Returns the date, when the resource was last modified, if known.
    long
    Returns the resources size, if known.
    Returns an URL, which may be used to reference the resource, if possible.
    boolean
    Returns, whether the FileInfo refers to a directory.
    boolean
    Returns, whether the resource exists.
    boolean
    Returns, whether the FileInfo refers to a file.

    Methods inherited from interface org.codehaus.plexus.components.io.fileselectors.FileInfo

    getName, isSymbolicLink
  • Field Details

    • UNKNOWN_RESOURCE_SIZE

      static final long UNKNOWN_RESOURCE_SIZE
      Unknown resource size.
      See Also:
    • UNKNOWN_MODIFICATION_DATE

      static final long UNKNOWN_MODIFICATION_DATE
      Unknown modification date
      See Also:
  • Method Details

    • getLastModified

      long getLastModified()
      Returns the date, when the resource was last modified, if known. Otherwise, returns UNKNOWN_MODIFICATION_DATE.
      See Also:
    • isExisting

      boolean isExisting()
      Returns, whether the resource exists.
    • getSize

      long getSize()
      Returns the resources size, if known. Otherwise returns UNKNOWN_RESOURCE_SIZE.
      Specified by:
      getSize in interface SizeSupplier
    • isFile

      boolean isFile()
      Returns, whether the FileInfo refers to a file.
      Specified by:
      isFile in interface FileInfo
    • isDirectory

      boolean isDirectory()
      Returns, whether the FileInfo refers to a directory.
      Specified by:
      isDirectory in interface FileInfo
    • getContents

      @Nonnull InputStream getContents() throws IOException
      Creates an InputStream, which may be used to read the files contents. This is useful, if the file selector comes to a decision based on the files contents.

      Please note that this InputStream is unbuffered. Clients should wrap this in a BufferedInputStream or attempt reading reasonably large chunks (8K+).

      Specified by:
      getContents in interface ContentSupplier
      Specified by:
      getContents in interface FileInfo
      Throws:
      IOException
    • getURL

      URL getURL() throws IOException
      Returns an URL, which may be used to reference the resource, if possible.
      Returns:
      An URL referencing the resource, if possible, or null. In the latter case, you are forced to use getContents().
      Throws:
      IOException