|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.FilterWriter
net.jangaroo.jooc.SubstitutingWriter
public abstract class SubstitutingWriter
An SubstitutingWriter is a FilterWriter that replaces each character in the output stream with the String obtained by calling the abstract method substitute on the characters.
Characters for which substitute returns null are output verbatim.
The implementation is fairly efficient in the number of calls to the various out.write methods.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
SubstitutingWriter(Writer out)
|
|
| Method Summary | |
|---|---|
protected abstract String |
substitute(char c)
What should be printed instead of character c?
This method is always called synchronized on out. |
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters, applying the substitution. |
void |
write(int c)
Write a single character, applying the substitution. |
void |
write(String str,
int off,
int len)
Write a portion of a string, applying the substitution. |
protected void |
writeReplacement(String replacement)
|
| Methods inherited from class java.io.FilterWriter |
|---|
close, flush |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SubstitutingWriter(Writer out)
| Method Detail |
|---|
protected abstract String substitute(char c)
c?
This method is always called synchronized on out.
Changes to the substitution function should therefore also be synchronized on out.
c - the character
c
protected void writeReplacement(String replacement)
throws IOException
IOException
public void write(int c)
throws IOException
write in class FilterWriterIOException - If an I/O error occurs
public void write(char[] cbuf,
int off,
int len)
throws IOException
write in class FilterWritercbuf - Buffer of characters to be writtenoff - Offset from which to start reading characterslen - Number of characters to be written
IOException - If an I/O error occurs
public void write(String str,
int off,
int len)
throws IOException
write in class FilterWriterstr - String to be writtenoff - Offset from which to start reading characterslen - Number of characters to be written
IOException - If an I/O error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||