com.compoze.util
Class TextLineFilterWriter
java.lang.Object
|
+--java.io.Writer
|
+--java.io.FilterWriter
|
+--com.compoze.util.TextLineFilterWriter
- Direct Known Subclasses:
- HtmlLinkFilterWriter, SubstitutionWriter
- public abstract class TextLineFilterWriter
- extends java.io.FilterWriter
This class is a filter writer that allows subclasses to process the text
that comes through a line at a time. This makes it easier for filter writers
that wish to process text to do their work. Subclasses must only implement
filterLine() to do their work. As data is written to this writer, it is
buffered until a full line of text is obtained. A line is considered to be
any amount of text followed by a newline, or a carriage return then a
newline. Once a full line of text is obtained filterLine() is called,
and the result is written to the underlying reader. The platform's default
line separator is always used. flush() must be called to insure that any
remaining text is written. Since this class works on text line-by-line it
is less appropriate for classes that need to filter multiple lines.
Fields inherited from class java.io.FilterWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Method Summary |
protected abstract java.lang.String |
filterLine(java.lang.String sLine)
Filter a line of text. |
void |
flush()
Flush the buffer and the underlying output writer. |
void |
write(char[] cBuffer,
int iOffset,
int iLength)
Write an array of characters. |
void |
write(int iChar)
Write a single character. |
void |
write(java.lang.String sString,
int iOffset,
int iLength)
Write a portion of a string. |
Methods inherited from class java.io.FilterWriter |
close |
Methods inherited from class java.io.Writer |
write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TextLineFilterWriter
public TextLineFilterWriter(java.io.Writer out)
- Constructor.
- Parameters:
out
- the underlying writer
write
public void write(char[] cBuffer,
int iOffset,
int iLength)
throws java.io.IOException
- Write an array of characters.
- Overrides:
write
in class java.io.FilterWriter
- Parameters:
cBuffer
- the character bufferiOffset
- the offset in the bufferiLength
- the length of the buffer- Throws:
java.io.IOException
- if an i/o exception occurred
write
public void write(int iChar)
throws java.io.IOException
- Write a single character.
- Overrides:
write
in class java.io.FilterWriter
- Parameters:
iChar
- the character to write- Throws:
java.io.IOException
- if an i/o exception occurred
write
public void write(java.lang.String sString,
int iOffset,
int iLength)
throws java.io.IOException
- Write a portion of a string.
- Overrides:
write
in class java.io.FilterWriter
- Parameters:
sString
- the string to writeiOffset
- the offset in the bufferiLength
- the length of the buffer- Throws:
java.io.IOException
- if an i/o exception occurred
flush
public void flush()
throws java.io.IOException
- Flush the buffer and the underlying output writer.
- Overrides:
flush
in class java.io.FilterWriter
- Throws:
java.io.IOException
- if an i/o exception occurred
filterLine
protected abstract java.lang.String filterLine(java.lang.String sLine)
- Filter a line of text. Subclasses must implement this to do their work.
- Parameters:
sLine
- the line to write (does not include line
termination characters)- Returns:
- the filtered line
Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.