edu.washington.cs.knowitall.io
Class TextBlockIterator

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<java.lang.String>
          extended by edu.washington.cs.knowitall.io.TextBlockIterator
All Implemented Interfaces:
java.util.Iterator<java.lang.String>

public class TextBlockIterator
extends com.google.common.collect.AbstractIterator<java.lang.String>

Buffers text "blocks" from a source of strings and iterates over the blocks. By default, a newline is used to separate blocks, but a custom value can be set.

Author:
afader

Constructor Summary
TextBlockIterator(java.io.BufferedReader reader)
          Constructs a TextBlockIterator using a newline as the default break.
TextBlockIterator(java.io.BufferedReader reader, java.lang.String blockBreak)
           
TextBlockIterator(java.lang.Iterable<java.lang.String> iter)
          Constructs a TextBlockIterator over the strings returned by iter, using the default block break.
TextBlockIterator(java.lang.Iterable<java.lang.String> iter, java.lang.String blockBreak)
          Constructs a TextBlockIterator over the strings returned by iter.
TextBlockIterator(java.util.Iterator<java.lang.String> lineIter)
          Constructs a TextBlockIterator over the strings returned by lineIter, using the default block break.
TextBlockIterator(java.util.Iterator<java.lang.String> lineIter, java.lang.String blockBreak)
          Constructs a TextBlockIterator over the strings returned by lineIter.
 
Method Summary
protected  java.lang.String computeNext()
           
 
Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBlockIterator

public TextBlockIterator(java.io.BufferedReader reader,
                         java.lang.String blockBreak)
Parameters:
reader - the reader to extract blocks from.
blockBreak - the value that represents a block break.

TextBlockIterator

public TextBlockIterator(java.io.BufferedReader reader)
Constructs a TextBlockIterator using a newline as the default break.

Parameters:
reader - the reader to extract blocks from.

TextBlockIterator

public TextBlockIterator(java.util.Iterator<java.lang.String> lineIter,
                         java.lang.String blockBreak)
Constructs a TextBlockIterator over the strings returned by lineIter.

Parameters:
lineIter -
blockBreak -

TextBlockIterator

public TextBlockIterator(java.util.Iterator<java.lang.String> lineIter)
Constructs a TextBlockIterator over the strings returned by lineIter, using the default block break.

Parameters:
lineIter -

TextBlockIterator

public TextBlockIterator(java.lang.Iterable<java.lang.String> iter,
                         java.lang.String blockBreak)
Constructs a TextBlockIterator over the strings returned by iter.

Parameters:
iter -
blockBreak -

TextBlockIterator

public TextBlockIterator(java.lang.Iterable<java.lang.String> iter)
Constructs a TextBlockIterator over the strings returned by iter, using the default block break.

Parameters:
iter -
Method Detail

computeNext

protected java.lang.String computeNext()
Specified by:
computeNext in class com.google.common.collect.AbstractIterator<java.lang.String>