public class SelectiveContentsTransformer extends Object implements ContentsTransformer
ContentsTransformer
that delegates contents transformation to one of two delegates, depending on whether
the path argument matches a string Predicate
or not.Constructor and Description |
---|
SelectiveContentsTransformer(Predicate<? super String> pathPredicate,
ContentsTransformer transformer,
ContentsTransformer delegate)
If the pathPredicate does not match the node's path, then the delegate is called.
|
Modifier and Type | Method and Description |
---|---|
static ContentsTransformer |
create(Predicate<? super String> pathPredicate,
ContentsTransformer transformer,
ContentsTransformer delegate)
Equivalent with
SelectiveContentsTransformer(Predicate, ContentsTransformer,
ContentsTransformer) , but conducts certain optimizations. |
String |
toString() |
void |
transform(String path,
InputStream is,
OutputStream os)
If the pathPredicate does not match the path, then the delegate is called with
arguments is and os.
|
public SelectiveContentsTransformer(Predicate<? super String> pathPredicate, ContentsTransformer transformer, ContentsTransformer delegate)
Notice that the preformance is particularly good if the transformer and/or the delegate
is ContentsTransformations.COPY
.
public static ContentsTransformer create(Predicate<? super String> pathPredicate, ContentsTransformer transformer, ContentsTransformer delegate)
SelectiveContentsTransformer(Predicate, ContentsTransformer,
ContentsTransformer)
, but conducts certain optimizations.
PredicateUtil.always()
PredicateUtil.never()
ContentsTransformations.COPY
ContentsTransformations.COPY
public void transform(String path, InputStream is, OutputStream os) throws IOException
transformer
before it is written to os.transform
in interface ContentsTransformer
path
- Designates the contents that is transformedIOException
Copyright © 2018 Arno Unkrig. All rights reserved.