|
Compoze Software, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.FilterWriter
com.compoze.util.TextLineFilterWriter
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.
Field Summary |
Fields inherited from class java.io.FilterWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
TextLineFilterWriter(java.io.Writer out)
Constructor. |
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 |
Constructor Detail |
public TextLineFilterWriter(java.io.Writer out)
out
- the underlying writerMethod Detail |
public void write(char[] cBuffer, int iOffset, int iLength) throws java.io.IOException
cBuffer
- the character bufferiOffset
- the offset in the bufferiLength
- the length of the buffer
java.io.IOException
- if an i/o exception occurredpublic void write(int iChar) throws java.io.IOException
iChar
- the character to write
java.io.IOException
- if an i/o exception occurredpublic void write(java.lang.String sString, int iOffset, int iLength) throws java.io.IOException
sString
- the string to writeiOffset
- the offset in the bufferiLength
- the length of the buffer
java.io.IOException
- if an i/o exception occurredpublic void flush() throws java.io.IOException
java.io.IOException
- if an i/o exception occurredprotected abstract java.lang.String filterLine(java.lang.String sLine)
sLine
- the line to write (does not include line
termination characters)
|
Compoze Software, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |