Interface PlexusIoResourceCollection

All Superinterfaces:
Iterable<PlexusIoResource>
All Known Subinterfaces:
PlexusIoArchivedResourceCollection
All Known Implementing Classes:
AbstractPlexusIoArchiveResourceCollection, AbstractPlexusIoResourceCollection, AbstractPlexusIoResourceCollectionWithAttributes, DefaultPlexusIoFileResourceCollection, PlexusIoCompressedFileResourceCollection, PlexusIoFileResourceCollection, PlexusIoProxyResourceCollection

public interface PlexusIoResourceCollection extends Iterable<PlexusIoResource>
A resource collection is a set of PlexusIoResource instances.
  • Method Details

    • getResources

      Iterator<PlexusIoResource> getResources() throws IOException
      Returns an iterator over the resources in the collection.
      Returns:
      An iterator
      Throws:
      IOException - .
    • stream

      Stream stream()
      Returns the resources as a stream.
      Returns:
      A stream for functional iteration
    • getName

      String getName(PlexusIoResource resource)
      Returns the resources suggested name. This is used for integrating file mappers.
      Parameters:
      resource - A resource, which has been obtained by calling getResources().
      Returns:
      The resource name. If it is a file, it should be normalized to platform separators
    • getLastModified

      long getLastModified() throws IOException
      Returns the collections last modification time. For a collection of files, this might be the last modification time of the file, which has been modified at last. For an archive file, this might be the modification time of the archive file.
      Returns:
      PlexusIoResource.UNKNOWN_MODIFICATION_DATE, if the collections last modification time is unknown, otherwise the last modification time in milliseconds.
      Throws:
      IOException - .
    • getInputStream

      InputStream getInputStream(PlexusIoResource resource) throws IOException
      Returns an input stream for the provided resource, with stream transformers applied
      Parameters:
      resource - The resources
      Returns:
      A possibly transformed resource
      Throws:
      IOException - when something goes bad
    • resolve

      PlexusIoResource resolve(PlexusIoResource resource) throws IOException
      Resolves the supplied resource into a "real" resource. Resolving means applying input transformations Returns an input stream for the provided resource, with stream transformers applied
      Parameters:
      resource - The resources
      Returns:
      A possibly transformed resource
      Throws:
      IOException - when something goes bad
    • isConcurrentAccessSupported

      boolean isConcurrentAccessSupported()
      Indicates if this collection supports concurrent access to its resources.

      Some resource collections (like tar files) may not support efficient random access or seek operation so implementations that represent such collections may not be able to provide concurrent access to its resources. If implementation returns false, then it is not safe to access its methods and resources in concurrent fashion. For example it is not safe to read from two resources in two concurrent threads, to read a resource and iterate over the iterator returned by getResources() in two concurrent threads, etc.

      Please note that this method indicates concurrent support only for the collection, not for the individual resources. This means there is no guarantee that the resources returned by resolve(PlexusIoResource) or the input stream returned by getInputStream(PlexusIoResource) are thread-safe, even if true is returned.

      Returns:
      true if this collection supports concurrent access, otherwise false