Package com.randomnoun.common
Class ResourceFinder.DisplayResourceFinderCallback
java.lang.Object
com.randomnoun.common.ResourceFinder.DisplayResourceFinderCallback
- All Implemented Interfaces:
ResourceFinder.ResourceFinderCallback
- Enclosing class:
ResourceFinder
public static class ResourceFinder.DisplayResourceFinderCallback
extends Object
implements ResourceFinder.ResourceFinderCallback
Class which defines a callback which sends names and resources to System.out.
This class uses '#' as a separator between the filesystem and files contained within archives; e.g. test.jar#abc.txt refers to abc.txt in test.jar.
For comparison, Tangosol seems to use '!', includes a leading slash and includes a protocol-like identifier at the beginning (e.g. jar:file:test.jar!/abc.txt). If a constructor is supplied which only provides a ZipInputStream (i.e. no filename is available), then resources will be returned starting with the '#' character.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionDisplayResourceFinderCallback
(int dumpType, List<Integer> dumpResourceNumbers, boolean verbose, boolean manifests, boolean decompile, String searchContents, boolean searchContentsIgnoreCase) -
Method Summary
Modifier and TypeMethodDescriptionpostProcess
(String resourceName, long filesize, long timestamp, InputStream inputStream, ResourceFinder.ResourceFinderCallbackResult preProcessResult) This method is invoked for each resource that matches the search criteria specified in the containingResourceFinder
class.preProcess
(String resourceName, long filesize, long timestamp, InputStream inputStream) This method is only invoked for archive resources, before that archive has been read or recursed into.
-
Field Details
-
DUMP_NAMES
- See Also:
-
DUMP_NAMES_AND_RESOURCES
- See Also:
-
DUMP_RESOURCES
- See Also:
-
-
Constructor Details
-
DisplayResourceFinderCallback
public DisplayResourceFinderCallback(int dumpType, List<Integer> dumpResourceNumbers, boolean verbose, boolean manifests, boolean decompile, String searchContents, boolean searchContentsIgnoreCase)
-
-
Method Details
-
preProcess
public ResourceFinder.ResourceFinderCallbackResult preProcess(String resourceName, long filesize, long timestamp, InputStream inputStream) throws IOException Description copied from interface:ResourceFinder.ResourceFinderCallback
This method is only invoked for archive resources, before that archive has been read or recursed into. Both archives and standard files will be passed to theResourceFinder.ResourceFinderCallback.postProcess(String, long, long, InputStream, ResourceFinderCallbackResult)
method.- Specified by:
preProcess
in interfaceResourceFinder.ResourceFinderCallback
- Parameters:
resourceName
- full resource namefilesize
- the size of the (uncompressed) resource, or -1 if this is unknown (some archives do not store this information)timestamp
- the timestamp of the resourceinputStream
- an inputStream which can be used to retrieve the contents of the resource- Returns:
- a ResourceFinderCallbackResult which can be used to abort the search or modify/wrap the inputStream being searched.
- Throws:
IOException
-
postProcess
public ResourceFinder.ResourceFinderCallbackResult postProcess(String resourceName, long filesize, long timestamp, InputStream inputStream, ResourceFinder.ResourceFinderCallbackResult preProcessResult) throws IOException Description copied from interface:ResourceFinder.ResourceFinderCallback
This method is invoked for each resource that matches the search criteria specified in the containingResourceFinder
class. This method is not responsible for closing the supplied inputStream.- Specified by:
postProcess
in interfaceResourceFinder.ResourceFinderCallback
- Parameters:
resourceName
- full resource namefilesize
- the size of the (uncompressed) resource, or -1 if this is unknown (some archives do not store this information)timestamp
- the timestamp of the resourceinputStream
- an inputStream which can be used to retrieve the contents of the resource- Returns:
- a ResourceFinderCallbackResult which can be used to abort the search
- Throws:
IOException
- if an operation on theinputStream
fails
-