The 'ReplacementInputStream' classes forming part of Swizzle Stream (for example, DelimitedTokenReplacementInputStream, FixedTokenListReplacementInputStream, and FixedTokenReplacementInputStream) all are subclasses of FilterInputStream.
However, they only seem to override the "int read()" single-byte read method, and do NOT seem to override the "int read(byte buf,int off,int len)" method from FilterInputStream.
The end result is that if:
a. You don't use the byte-by-byte read method, OR
b. You wrap this in nearly any other FilterInputStream (which generally do not use the byte-by-byte read method).
then the ReplacementInputStream will appear to have no effect at all.
The solution to this is to properly override the "int read(byte buf,int off,int len)".
I've attached a patch ("swizzle-fix-read-bug.patch") which includes a 'fix' for this problem, but is likely not the most efficient way to manage things.
What this patch does is:
a. Change each affected class to extend "_FixFilterInputStream" instead of "FilterInputStream".
b. Create a "int read(byte buf,int off,int len)" in "_FixFilterInputStream" that calls the "int read()" method iteratively to fulfill the request.
As I've said, this is not the best or most efficient solution to the problem, but it is a pretty non-invasive solution.