public interface PlexusIoResourceCollection extends Iterable<PlexusIoResource>
PlexusIoResource
instances.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ROLE_HINT
Role hint of the default resource collection, which is a set
of files in a base directory.
|
static String |
ROLE
Role of the ResourceCollection component.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream(PlexusIoResource resource)
Returns an input stream for the provided resource, with stream transformers applied
|
long |
getLastModified()
Returns the collections last modification time.
|
String |
getName(PlexusIoResource resource)
Returns the resources suggested name.
|
Iterator<PlexusIoResource> |
getResources()
Returns an iterator over the resources in the collection.
|
boolean |
isConcurrentAccessSupported()
Indicates if this collection supports concurrent access to its resources.
|
PlexusIoResource |
resolve(PlexusIoResource resource)
Resolves the supplied resource into a "real" resource.
|
Stream |
stream()
Returns the resources as a stream.
|
forEach, iterator, spliterator
static final String ROLE
static final String DEFAULT_ROLE_HINT
Iterator<PlexusIoResource> getResources() throws IOException
IOException
- .Stream stream()
String getName(PlexusIoResource resource)
resource
- A resource, which has been obtained by
calling getResources()
.long getLastModified() throws IOException
PlexusIoResource.UNKNOWN_MODIFICATION_DATE
,
if the collections last modification time is unknown,
otherwise the last modification time in milliseconds.IOException
- .InputStream getInputStream(PlexusIoResource resource) throws IOException
resource
- The resourcesIOException
- when something goes badPlexusIoResource resolve(PlexusIoResource resource) throws IOException
resource
- The resourcesIOException
- when something goes badboolean isConcurrentAccessSupported()
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.
true
if this collection supports concurrent access,
otherwise false
Copyright © 2001–2022 Codehaus Plexus. All rights reserved.