nl.gx.webmanager.handler.util
Class StreamingParser

java.lang.Object
  extended by java.io.Writer
      extended by nl.gx.webmanager.handler.util.StreamingParser
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public abstract class StreamingParser
extends java.io.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.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
StreamingParser(java.lang.String startDelimiter, java.lang.String endDelimiter)
          Constructs a StreamingParser.
 
Method Summary
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(java.lang.String startTag, java.lang.String value, java.lang.String endTag)
           
static void main(java.lang.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(java.lang.String str)
          Write a string.
 
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

StreamingParser

public StreamingParser(java.lang.String startDelimiter,
                       java.lang.String endDelimiter)
Constructs a StreamingParser.

Parameters:
startDelimiter - The start string
endDelimiter - The end string
Method Detail

handle

protected abstract void handle(java.lang.String startTag,
                               java.lang.String value,
                               java.lang.String endTag)
                        throws java.io.IOException
Throws:
java.io.IOException

characters

protected abstract void characters(char[] values,
                                   int from,
                                   int to)
                            throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int c)
           throws java.io.IOException
Write a single character.

Overrides:
write in class java.io.Writer
Parameters:
c - int specifying a character to be written.
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(char[] str,
                  int off,
                  int len)
           throws java.io.IOException
Write a portion of an array of characters.

Specified by:
write in class java.io.Writer
Parameters:
str - Array of characters
off - Offset from which to start writing characters
len - Number of characters to write
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(java.lang.String str)
           throws java.io.IOException
Write a string.

Overrides:
write in class java.io.Writer
Parameters:
str - String to be written
Throws:
java.io.IOException - If an I/O error occurs

flush

public void flush()
           throws java.io.IOException
Flush the stream.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException - If an I/O error occurs

close

public void close()
           throws java.io.IOException
Close the stream, flushing it first. The underlying output stream will not be closed.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException - If an I/O error occurs

finish

protected void finish()
               throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)


Copyright © 2007-2011 GX Software BV. All Rights Reserved.