Package com.randomnoun.common
Class ResourceFinder.HashingResourceFinderCallback
java.lang.Object
com.randomnoun.common.ResourceFinder.HashingResourceFinderCallback
- All Implemented Interfaces:
ResourceFinder.ResourceFinderCallback
- Enclosing class:
ResourceFinder
public static class ResourceFinder.HashingResourceFinderCallback
extends Object
implements ResourceFinder.ResourceFinderCallback
Class which defines a callback which sends names and resource hashes to System.out.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
ignorableException
(String message, Exception e) postProcess
(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.
-
Constructor Details
-
HashingResourceFinderCallback
-
-
Method Details
-
ignorableException
- Throws:
ZipException
-
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
-