public abstract class PlexusIoCompressedFileResourceCollection extends Object implements PlexusIoArchivedResourceCollection, Iterable<PlexusIoResource>
Constructor and Description |
---|
PlexusIoCompressedFileResourceCollection() |
Modifier and Type | Method and Description |
---|---|
protected abstract PlexusIoResourceAttributes |
getAttributes(File f) |
protected abstract String |
getDefaultExtension() |
File |
getFile()
Returns the archive file
|
protected abstract InputStream |
getInputStream(File file) |
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 String |
getName(File file) |
String |
getName(PlexusIoResource resource)
Returns the resources suggested name.
|
String |
getPath() |
Iterator<PlexusIoResource> |
getResources()
Returns an iterator over the resources in the collection.
|
boolean |
isConcurrentAccessSupported()
Indicates if this collection supports concurrent access to its resources.
|
Iterator<PlexusIoResource> |
iterator() |
PlexusIoResource |
resolve(PlexusIoResource resource)
Resolves the supplied resource into a "real" resource.
|
void |
setFile(File file)
Sets the archive file
|
void |
setPath(String path) |
void |
setStreamTransformer(InputStreamTransformer streamTransformers) |
Stream |
stream()
Returns the resources as a stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public PlexusIoCompressedFileResourceCollection()
public File getFile()
PlexusIoArchivedResourceCollection
getFile
in interface PlexusIoArchivedResourceCollection
public void setFile(File file)
PlexusIoArchivedResourceCollection
setFile
in interface PlexusIoArchivedResourceCollection
public String getPath()
public void setPath(String path)
protected abstract PlexusIoResourceAttributes getAttributes(File f) throws IOException
IOException
public void setStreamTransformer(InputStreamTransformer streamTransformers)
public Stream stream()
PlexusIoResourceCollection
stream
in interface PlexusIoResourceCollection
public Iterator<PlexusIoResource> getResources() throws IOException
PlexusIoResourceCollection
getResources
in interface PlexusIoResourceCollection
IOException
- .protected String getName(File file) throws IOException
IOException
protected abstract String getDefaultExtension()
@Nonnull protected abstract InputStream getInputStream(File file) throws IOException
IOException
public InputStream getInputStream(PlexusIoResource resource) throws IOException
PlexusIoResourceCollection
getInputStream
in interface PlexusIoResourceCollection
resource
- The resourcesIOException
- when something goes badpublic PlexusIoResource resolve(PlexusIoResource resource) throws IOException
PlexusIoResourceCollection
resolve
in interface PlexusIoResourceCollection
resource
- The resourcesIOException
- when something goes badpublic Iterator<PlexusIoResource> iterator()
iterator
in interface Iterable<PlexusIoResource>
public String getName(PlexusIoResource resource)
PlexusIoResourceCollection
getName
in interface PlexusIoResourceCollection
resource
- A resource, which has been obtained by
calling PlexusIoResourceCollection.getResources()
.public long getLastModified() throws 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.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
Copyright © 2001–2023 Codehaus Plexus. All rights reserved.