public abstract class PlexusIoCompressedFileResourceCollection extends java.lang.Object implements PlexusIoArchivedResourceCollection, java.lang.Iterable<PlexusIoResource>
Modifier and Type | Field and Description |
---|---|
private java.io.File |
file |
private java.lang.String |
path |
private InputStreamTransformer |
streamTransformers |
DEFAULT_ROLE_HINT, ROLE
Constructor and Description |
---|
PlexusIoCompressedFileResourceCollection() |
Modifier and Type | Method and Description |
---|---|
protected abstract PlexusIoResourceAttributes |
getAttributes(java.io.File f) |
protected abstract java.lang.String |
getDefaultExtension() |
java.io.File |
getFile()
Returns the archive file
|
protected abstract java.io.InputStream |
getInputStream(java.io.File file) |
java.io.InputStream |
getInputStream(PlexusIoResource resource)
Returns an input stream for the provided resource, with stream transformers applied
|
long |
getLastModified()
Returns the collections last modification time.
|
protected java.lang.String |
getName(java.io.File file) |
java.lang.String |
getName(PlexusIoResource resource)
Returns the resources suggested name.
|
java.lang.String |
getPath() |
java.util.Iterator<PlexusIoResource> |
getResources()
Returns an iterator over the resources in the collection.
|
boolean |
isConcurrentAccessSupported()
Indicates if this collection supports concurrent access to its resources.
|
java.util.Iterator<PlexusIoResource> |
iterator() |
PlexusIoResource |
resolve(PlexusIoResource resource)
Resolves the supplied resource into a "real" resource.
|
void |
setFile(java.io.File file)
Sets the archive file
|
void |
setPath(java.lang.String path) |
void |
setStreamTransformer(InputStreamTransformer streamTransformers) |
Stream |
stream()
Returns the resources as a stream.
|
private java.io.File file
private java.lang.String path
private InputStreamTransformer streamTransformers
public PlexusIoCompressedFileResourceCollection()
public java.io.File getFile()
PlexusIoArchivedResourceCollection
getFile
in interface PlexusIoArchivedResourceCollection
public void setFile(java.io.File file)
PlexusIoArchivedResourceCollection
setFile
in interface PlexusIoArchivedResourceCollection
public java.lang.String getPath()
public void setPath(java.lang.String path)
protected abstract PlexusIoResourceAttributes getAttributes(java.io.File f) throws java.io.IOException
java.io.IOException
public void setStreamTransformer(InputStreamTransformer streamTransformers)
public Stream stream()
PlexusIoResourceCollection
stream
in interface PlexusIoResourceCollection
public java.util.Iterator<PlexusIoResource> getResources() throws java.io.IOException
PlexusIoResourceCollection
getResources
in interface PlexusIoResourceCollection
java.io.IOException
- .protected java.lang.String getName(java.io.File file) throws java.io.IOException
java.io.IOException
protected abstract java.lang.String getDefaultExtension()
@Nonnull protected abstract java.io.InputStream getInputStream(java.io.File file) throws java.io.IOException
java.io.IOException
public java.io.InputStream getInputStream(PlexusIoResource resource) throws java.io.IOException
PlexusIoResourceCollection
getInputStream
in interface PlexusIoResourceCollection
resource
- The resourcesjava.io.IOException
- when something goes badpublic PlexusIoResource resolve(PlexusIoResource resource) throws java.io.IOException
PlexusIoResourceCollection
resolve
in interface PlexusIoResourceCollection
resource
- The resourcesjava.io.IOException
- when something goes badpublic java.util.Iterator<PlexusIoResource> iterator()
iterator
in interface java.lang.Iterable<PlexusIoResource>
public java.lang.String getName(PlexusIoResource resource)
PlexusIoResourceCollection
getName
in interface PlexusIoResourceCollection
resource
- A resource, which has been obtained by
calling PlexusIoResourceCollection.getResources()
.public long getLastModified() throws java.io.IOException
PlexusIoResourceCollection
getLastModified
in interface PlexusIoResourceCollection
PlexusIoResource.UNKNOWN_MODIFICATION_DATE
,
if the collections last modification time is unknown,
otherwise the last modification time in milliseconds.java.io.IOException
- .public boolean isConcurrentAccessSupported()
PlexusIoResourceCollection
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 PlexusIoResourceCollection.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 PlexusIoResourceCollection.resolve(PlexusIoResource)
or the input stream
returned by PlexusIoResourceCollection.getInputStream(PlexusIoResource)
are thread-safe,
even if true
is returned.
isConcurrentAccessSupported
in interface PlexusIoResourceCollection
true
if this collection supports concurrent access,
otherwise false