Package proguard.resources.file
Class ResourceFilePool
- java.lang.Object
-
- proguard.resources.file.ResourceFilePool
-
- All Implemented Interfaces:
FilePool
public class ResourceFilePool extends java.lang.Object implements FilePool
This is a set ofResourceFile
instances. They can be enumerated or retrieved by name. They can also be accessed by means of resource file visitors.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,ResourceFile>
resourceFileMap
-
Constructor Summary
Constructors Constructor Description ResourceFilePool()
Creates a new empty ResourceFilePool.ResourceFilePool(java.lang.Iterable<? extends ResourceFile> resourceFiles)
Creates a new ResourceFilePool with the given resource files.ResourceFilePool(ResourceFile... resourceFiles)
Creates a new ResourceFilePool with the given resource files.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResourceFile(java.lang.String fileName, ResourceFile resourceFile)
Adds the given ResourceFile with the given name to this pool.void
addResourceFile(ResourceFile resourceFile)
Adds the given ResourceFile to this pool.void
clear()
Clears the pool.ResourceFile
getResourceFile(java.lang.String fileName)
Returns a ResourceFile from this pool, based on its name.ResourceFilePool
refreshedCopy()
Returns a ResourceFilePool with the same resource files, but with the keys that correspond to the names of the resource file instances.void
removeResourceFile(java.lang.String fileName)
Removes the specified ResourceFile from this pool.java.util.Set<java.lang.String>
resourceFileNames()
Returns a Set of all resource file names in this resource file pool.void
resourceFilesAccept(java.lang.String fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filter.void
resourceFilesAccept(java.util.List<java.lang.String> fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filters.void
resourceFilesAccept(ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all instances in this pool.void
resourceFilesAccept(StringMatcher fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filter.int
size()
Returns the number of resource files in this pool.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface proguard.resources.file.FilePool
resourceFileAccept
-
-
-
-
Field Detail
-
resourceFileMap
protected final java.util.Map<java.lang.String,ResourceFile> resourceFileMap
-
-
Constructor Detail
-
ResourceFilePool
public ResourceFilePool()
Creates a new empty ResourceFilePool.
-
ResourceFilePool
public ResourceFilePool(ResourceFile... resourceFiles)
Creates a new ResourceFilePool with the given resource files.- Parameters:
resourceFiles
- the resource files to be added.
-
ResourceFilePool
public ResourceFilePool(java.lang.Iterable<? extends ResourceFile> resourceFiles)
Creates a new ResourceFilePool with the given resource files.- Parameters:
resourceFiles
- the resource files to be added.
-
-
Method Detail
-
clear
public void clear()
Clears the pool.
-
addResourceFile
public void addResourceFile(ResourceFile resourceFile)
Adds the given ResourceFile to this pool.
-
addResourceFile
public void addResourceFile(java.lang.String fileName, ResourceFile resourceFile)
Adds the given ResourceFile with the given name to this pool.
-
removeResourceFile
public void removeResourceFile(java.lang.String fileName)
Removes the specified ResourceFile from this pool.
-
getResourceFile
public ResourceFile getResourceFile(java.lang.String fileName)
Returns a ResourceFile from this pool, based on its name. Returnsnull
if the instance with the given name is not in the pool.- Specified by:
getResourceFile
in interfaceFilePool
-
size
public int size()
Returns the number of resource files in this pool.
-
refreshedCopy
public ResourceFilePool refreshedCopy()
Returns a ResourceFilePool with the same resource files, but with the keys that correspond to the names of the resource file instances. This can be useful to create a resource file pool with obfuscated names.
-
resourceFileNames
public java.util.Set<java.lang.String> resourceFileNames()
Returns a Set of all resource file names in this resource file pool.- Specified by:
resourceFileNames
in interfaceFilePool
-
resourceFilesAccept
public void resourceFilesAccept(ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all instances in this pool.- Specified by:
resourceFilesAccept
in interfaceFilePool
-
resourceFilesAccept
public void resourceFilesAccept(java.lang.String fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filter.- Specified by:
resourceFilesAccept
in interfaceFilePool
-
resourceFilesAccept
public void resourceFilesAccept(java.util.List<java.lang.String> fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filters.- Specified by:
resourceFilesAccept
in interfaceFilePool
-
resourceFilesAccept
public void resourceFilesAccept(StringMatcher fileNameFilter, ResourceFileVisitor resourceFileVisitor)
Applies the given ResourceFileVisitor to all resource files in this pool matching the given file name filter.- Specified by:
resourceFilesAccept
in interfaceFilePool
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-