de.saar.basic
Class ReplacingWriter
Object
Writer
FilterWriter
ReplacingWriter
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
- Direct Known Subclasses:
- XmlEncodingWriter
public class ReplacingWriter
- extends FilterWriter
A class which replaces strings by other strings in every call
to the write methods.
- Author:
- Alexander Koller
Method Summary |
void |
addReplacementRule(String L,
String R)
Adds a replacement rule. |
void |
write(char[] cbuf,
int off,
int len)
|
void |
write(int c)
|
void |
write(String str,
int off,
int len)
|
Methods inherited from class FilterWriter |
close, flush |
Methods inherited from class Writer |
append, append, append, write, write |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplacingWriter
public ReplacingWriter(Writer writer)
addReplacementRule
public void addReplacementRule(String L,
String R)
- Adds a replacement rule. From now on,
L
will
be replaced by R
in every call to write
.
- Parameters:
L
- the left-hand side of a replacement ruleR
- the right-hand side of a replacement rule
write
public void write(char[] cbuf,
int off,
int len)
throws IOException
- Overrides:
write
in class FilterWriter
- Throws:
IOException
write
public void write(int c)
throws IOException
- Overrides:
write
in class FilterWriter
- Throws:
IOException
write
public void write(String str,
int off,
int len)
throws IOException
- Overrides:
write
in class FilterWriter
- Throws:
IOException