Package nl.gx.webmanager.handler.util
Class StreamingParser
- java.lang.Object
-
- java.io.Writer
-
- nl.gx.webmanager.handler.util.StreamingParser
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public abstract class StreamingParser extends Writer
Baseclass for LoggingFilterWriter. Provides functionality to filter a writer. It looks for a begin and end delimiter and calls the handle method when a pair is found. Subclasses must implement this handle method.
-
-
Constructor Summary
Constructors Constructor Description StreamingParser(String startDelimiter, String endDelimiter)
Constructs a StreamingParser.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
characters(char[] values, int from, int to)
void
close()
Close the stream, flushing it first.protected void
finish()
void
flush()
Flush the stream.protected abstract void
handle(String startTag, String value, String endTag)
static void
main(String[] args)
void
write(char[] str, int off, int len)
Write a portion of an array of characters.void
write(int c)
Write a single character.void
write(String str)
Write a string.
-
-
-
Method Detail
-
handle
protected abstract void handle(String startTag, String value, String endTag) throws IOException
- Throws:
IOException
-
characters
protected abstract void characters(char[] values, int from, int to) throws IOException
- Throws:
IOException
-
write
public void write(int c) throws IOException
Write a single character.- Overrides:
write
in classWriter
- Parameters:
c
- int specifying a character to be written.- Throws:
IOException
- If an I/O error occurs
-
write
public void write(char[] str, int off, int len) throws IOException
Write a portion of an array of characters.- Specified by:
write
in classWriter
- Parameters:
str
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to write- Throws:
IOException
- If an I/O error occurs
-
write
public void write(String str) throws IOException
Write a string.- Overrides:
write
in classWriter
- Parameters:
str
- String to be written- Throws:
IOException
- If an I/O error occurs
-
flush
public void flush() throws IOException
Flush the stream.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
- If an I/O error occurs
-
close
public void close() throws IOException
Close the stream, flushing it first. The underlying output stream will not be closed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
- If an I/O error occurs
-
finish
protected void finish() throws IOException
- Throws:
IOException
-
main
public static void main(String[] args)
-
-