Package com.randomnoun.common
Interface ResourceFinder.ResourceFinderCallback
- All Known Implementing Classes:
ResourceFinder.DisplayResourceFinderCallback
,ResourceFinder.HashingResourceFinderCallback
- Enclosing class:
ResourceFinder
public static interface ResourceFinder.ResourceFinderCallback
A callback interface used when resources are found using this object
-
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.
-
Method Details
-
preProcess
ResourceFinder.ResourceFinderCallbackResult preProcess(String resourceName, long filesize, long timestamp, InputStream inputStream) throws IOException 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 thepostProcess(String, long, long, InputStream, ResourceFinderCallbackResult)
method.- 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
ResourceFinder.ResourceFinderCallbackResult postProcess(String resourceName, long filesize, long timestamp, InputStream inputStream, ResourceFinder.ResourceFinderCallbackResult preProcessResult) throws IOException 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.- 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
-