Class PlexusIoCompressedFileResourceCollection
- All Implemented Interfaces:
Iterable<PlexusIoResource>
,PlexusIoArchivedResourceCollection
,PlexusIoResourceCollection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract PlexusIoResourceAttributes
protected abstract String
getFile()
Returns the archive fileprotected abstract InputStream
getInputStream
(File file) getInputStream
(PlexusIoResource resource) Returns an input stream for the provided resource, with stream transformers appliedlong
Returns the collections last modification time.protected String
getName
(PlexusIoResource resource) Returns the resources suggested name.getPath()
Returns an iterator over the resources in the collection.boolean
Indicates if this collection supports concurrent access to its resources.iterator()
resolve
(PlexusIoResource resource) Resolves the supplied resource into a "real" resource.void
Sets the archive filevoid
void
setStreamTransformer
(InputStreamTransformer streamTransformers) stream()
Returns the resources as a stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PlexusIoCompressedFileResourceCollection
public PlexusIoCompressedFileResourceCollection()
-
-
Method Details
-
getFile
Description copied from interface:PlexusIoArchivedResourceCollection
Returns the archive file- Specified by:
getFile
in interfacePlexusIoArchivedResourceCollection
-
setFile
Description copied from interface:PlexusIoArchivedResourceCollection
Sets the archive file- Specified by:
setFile
in interfacePlexusIoArchivedResourceCollection
-
getPath
-
setPath
-
getAttributes
- Throws:
IOException
-
setStreamTransformer
-
stream
Description copied from interface:PlexusIoResourceCollection
Returns the resources as a stream.- Specified by:
stream
in interfacePlexusIoResourceCollection
- Returns:
- A stream for functional iteration
-
getResources
Description copied from interface:PlexusIoResourceCollection
Returns an iterator over the resources in the collection.- Specified by:
getResources
in interfacePlexusIoResourceCollection
- Returns:
- An iterator
- Throws:
IOException
- .
-
getName
- Throws:
IOException
-
getDefaultExtension
-
getInputStream
- Throws:
IOException
-
getInputStream
Description copied from interface:PlexusIoResourceCollection
Returns an input stream for the provided resource, with stream transformers applied- Specified by:
getInputStream
in interfacePlexusIoResourceCollection
- Parameters:
resource
- The resources- Returns:
- A possibly transformed resource
- Throws:
IOException
- when something goes bad
-
resolve
Description copied from interface:PlexusIoResourceCollection
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- Specified by:
resolve
in interfacePlexusIoResourceCollection
- Parameters:
resource
- The resources- Returns:
- A possibly transformed resource
- Throws:
IOException
- when something goes bad
-
iterator
- Specified by:
iterator
in interfaceIterable<PlexusIoResource>
-
getName
Description copied from interface:PlexusIoResourceCollection
Returns the resources suggested name. This is used for integrating file mappers.- Specified by:
getName
in interfacePlexusIoResourceCollection
- Parameters:
resource
- A resource, which has been obtained by callingPlexusIoResourceCollection.getResources()
.- Returns:
- The resource name. If it is a file, it should be normalized to platform separators
-
getLastModified
Description copied from interface:PlexusIoResourceCollection
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.- Specified by:
getLastModified
in interfacePlexusIoResourceCollection
- Returns:
PlexusIoResource.UNKNOWN_MODIFICATION_DATE
, if the collections last modification time is unknown, otherwise the last modification time in milliseconds.- Throws:
IOException
- .
-
isConcurrentAccessSupported
public boolean isConcurrentAccessSupported()Description copied from interface:PlexusIoResourceCollection
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 byPlexusIoResourceCollection.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 byPlexusIoResourceCollection.getInputStream(PlexusIoResource)
are thread-safe, even iftrue
is returned.- Specified by:
isConcurrentAccessSupported
in interfacePlexusIoResourceCollection
- Returns:
true
if this collection supports concurrent access, otherwisefalse
-