Class PlexusIoFileResourceCollection
- java.lang.Object
-
- org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollection
-
- org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollectionWithAttributes
-
- org.codehaus.plexus.components.io.resources.PlexusIoFileResourceCollection
-
- All Implemented Interfaces:
Iterable<PlexusIoResource>
,PlexusIoResourceCollection
- Direct Known Subclasses:
DefaultPlexusIoFileResourceCollection
@Named("files") public class PlexusIoFileResourceCollection extends AbstractPlexusIoResourceCollectionWithAttributes
Implementation ofPlexusIoResourceCollection
for the set of files in a common directory.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ROLE_HINT
Role hint of this component-
Fields inherited from class org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollection
identityTransformer
-
-
Constructor Summary
Constructors Constructor Description PlexusIoFileResourceCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getBaseDir()
InputStream
getInputStream(PlexusIoResource resource)
Returns an input stream for the provided resource, with stream transformers appliedString
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.boolean
isFollowingSymLinks()
PlexusIoResource
resolve(PlexusIoResource resource)
Resolves the supplied resource into a "real" resource.void
setBaseDir(File baseDir)
void
setDefaultAttributes(int uid, String userName, int gid, String groupName, int fileMode, int dirMode)
void
setFilenameComparator(Comparator<String> filenameComparator)
void
setFollowingSymLinks(boolean pIsFollowingSymLinks)
void
setOverrideAttributes(int uid, String userName, int gid, String groupName, int fileMode, int dirMode)
void
setPrefix(String prefix)
Sets the prefix, which the file sets contents shall have.Stream
stream()
Returns the resources as a stream.-
Methods inherited from class org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollectionWithAttributes
getDefaultDirAttributes, getDefaultFileAttributes, getOverrideDirAttributes, getOverrideFileAttributes, mergeAttributes, setDefaultDirAttributes, setDefaultFileAttributes, setOverrideDirAttributes, setOverrideFileAttributes
-
Methods inherited from class org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollection
getExcludes, getFileMappers, getFileSelectors, getIncludes, getLastModified, getName, getPrefix, getStreamTransformer, isCaseSensitive, isIncludingEmptyDirectories, isSelected, isUsingDefaultExcludes, iterator, setCaseSensitive, setExcludes, setFileMappers, setFileSelectors, setIncludes, setIncludingEmptyDirectories, setStreamTransformer, setUsingDefaultExcludes
-
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
-
-
-
-
Field Detail
-
ROLE_HINT
public static final String ROLE_HINT
Role hint of this component- See Also:
- Constant Field Values
-
-
Method Detail
-
resolve
public PlexusIoResource resolve(PlexusIoResource resource) throws IOException
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
- Overrides:
resolve
in classAbstractPlexusIoResourceCollection
- Parameters:
resource
- The resources- Returns:
- A possibly transformed resource
- Throws:
IOException
- when something goes bad
-
getInputStream
public InputStream getInputStream(PlexusIoResource resource) throws IOException
Description copied from interface:PlexusIoResourceCollection
Returns an input stream for the provided resource, with stream transformers applied- Specified by:
getInputStream
in interfacePlexusIoResourceCollection
- Overrides:
getInputStream
in classAbstractPlexusIoResourceCollection
- Parameters:
resource
- The resources- Returns:
- A possibly transformed resource
- Throws:
IOException
- when something goes bad
-
getName
public String getName(PlexusIoResource resource)
Description copied from interface:PlexusIoResourceCollection
Returns the resources suggested name. This is used for integrating file mappers.- Specified by:
getName
in interfacePlexusIoResourceCollection
- Overrides:
getName
in classAbstractPlexusIoResourceCollection
- 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
-
setBaseDir
public void setBaseDir(File baseDir)
- Parameters:
baseDir
- The base directory of the file collection
-
getBaseDir
public File getBaseDir()
- Returns:
- Returns the file collections base directory.
-
isFollowingSymLinks
public boolean isFollowingSymLinks()
- Returns:
- Returns, whether symbolic links should be followed. Defaults to true.
-
setFollowingSymLinks
public void setFollowingSymLinks(boolean pIsFollowingSymLinks)
- Parameters:
pIsFollowingSymLinks
- whether symbolic links should be followed
-
setDefaultAttributes
public void setDefaultAttributes(int uid, String userName, int gid, String groupName, int fileMode, int dirMode)
-
setOverrideAttributes
public void setOverrideAttributes(int uid, String userName, int gid, String groupName, int fileMode, int dirMode)
-
setPrefix
public void setPrefix(String prefix)
Description copied from class:AbstractPlexusIoResourceCollection
Sets the prefix, which the file sets contents shall have.- Overrides:
setPrefix
in classAbstractPlexusIoResourceCollection
-
stream
public Stream stream()
Description copied from interface:PlexusIoResourceCollection
Returns the resources as a stream.- Returns:
- A stream for functional iteration
-
getResources
public Iterator<PlexusIoResource> getResources() throws IOException
Description copied from interface:PlexusIoResourceCollection
Returns an iterator over the resources in the collection.- Returns:
- An iterator
- 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.- Returns:
true
if this collection supports concurrent access, otherwisefalse
-
setFilenameComparator
public void setFilenameComparator(Comparator<String> filenameComparator)
- Since:
- 3.2.0
-
-