de.unkrig.commons.file.contentsprocessing
Class SelectiveContentsProcessor<T>

java.lang.Object
  extended by de.unkrig.commons.file.contentsprocessing.SelectiveContentsProcessor<T>
Type Parameters:
T - The type returned by process(String, InputStream, long, long, ProducerWhichThrows)
All Implemented Interfaces:
ContentsProcessor<T>

public class SelectiveContentsProcessor<T>
extends java.lang.Object
implements ContentsProcessor<T>

See Also:
process(String, InputStream, long, long, ProducerWhichThrows)

Constructor Summary
SelectiveContentsProcessor(Predicate<java.lang.String> pathPredicate, ContentsProcessor<T> trueDelegate, ContentsProcessor<T> falseDelegate)
           
 
Method Summary
 T process(java.lang.String path, java.io.InputStream is, long size, long crc32, ProducerWhichThrows<java.io.InputStream,java.io.IOException> opener)
          If the pathPredicate evaluates to true for the path, then the trueDelegate is called, otherwise the falseDelegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectiveContentsProcessor

public SelectiveContentsProcessor(Predicate<java.lang.String> pathPredicate,
                                  ContentsProcessor<T> trueDelegate,
                                  ContentsProcessor<T> falseDelegate)
Method Detail

process

@Nullable
public T process(java.lang.String path,
                          java.io.InputStream is,
                          long size,
                          long crc32,
                          ProducerWhichThrows<java.io.InputStream,java.io.IOException> opener)
          throws java.io.IOException
If the pathPredicate evaluates to true for the path, then the trueDelegate is called, otherwise the falseDelegate.

Specified by:
process in interface ContentsProcessor<T>
Parameters:
path - E.g. "c:/dir/zipfile!dir/zipfile!dir/file"
size - -1 if unknown
crc32 - -1 if unknown
opener - Re-produces the inputStream
Throws:
java.io.IOException - Message should NOT include the path