de.dfki.lt.mary.util
Class ReaderSplitter

java.lang.Object
  extended by de.dfki.lt.mary.util.ReaderSplitter

public class ReaderSplitter
extends java.lang.Object

A class splitting a Reader into chunks. In a continuous input Reader, search for lines containing a specific "end-of-chunk" marking (e.g., an XML root end tag), and return individual readers, each of which will provide one chunk (including the line containing the end-of-chunk marking).

Author:
Marc Schröder

Constructor Summary
ReaderSplitter(java.io.Reader in, java.lang.String endMarker)
           
 
Method Summary
 java.io.Reader nextReader()
          Return a reader from which one chunk can be read, followed by EOF.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderSplitter

public ReaderSplitter(java.io.Reader in,
                      java.lang.String endMarker)
Method Detail

nextReader

public java.io.Reader nextReader()
                          throws java.io.IOException
Return a reader from which one chunk can be read, followed by EOF. Chunks are delimited by start of file, lines containing the end marker string (line is last line in chunk), and end of file. Returns null if nothing more can be read.

Throws:
java.io.IOException