Package i2p.susi.util
Class RegexOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- i2p.susi.util.RegexOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class RegexOutputStream extends FilterOutputStream
Replace patterns with a simple regex on the fly. Case insensitive.- Since:
- 0.9.62
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
idx
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description RegexOutputStream(OutputStream out, String pattern, String replace, String onNoMatch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static void
main(String[] args)
void
write(int val)
-
Methods inherited from class java.io.FilterOutputStream
flush, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
RegexOutputStream
public RegexOutputStream(OutputStream out, String pattern, String replace, String onNoMatch)
- Parameters:
out
- MUST be buffered because this writes one byte at a timepattern
- the only special char recognized is '*' and cannot be at the beginning or end or have two in a row. ASCII-only, no UTF-8.replace
- ASCII-only, no UTF-8.onNoMatch
- force output of this at the end if no replacement made, or null
-
-
Method Detail
-
write
public void write(int val) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
-