jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap.io
Class StructureRecordIterator

Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<StructureRecord>
          extended by com.chemaxon.overlap.io.StructureRecordIterator
All Implemented Interfaces:
Closeable, Iterator<StructureRecord>

public class StructureRecordIterator
extends AbstractIterator<StructureRecord>
implements Closeable

Class encapsulating MRecordReader.

Closes underlying reader upon explicit close.

Author:
Gabor Imre

Constructor Summary
StructureRecordIterator(InputStream is, String opts)
          New instance.
 
Method Summary
 void close()
           
protected  StructureRecord computeNext()
           
 String getFormat()
          Get format.
 
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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureRecordIterator

public StructureRecordIterator(InputStream is,
                               String opts)
New instance.

Note that empty stream can not be wrapped. Otherwise getFormat() would need to be ambiguous in case of empty stream.

Parameters:
is - InputStream to read from. Note that the passed stream is read but not closed when end reached. Method close() closes the underlying MRecordReader. Note that if the stream is empty IllegalArgumentException thrown.
opts - Options to pass to underlying MFileFormatUtil.createRecordReader(java.io.InputStream, java.lang.String)
Throws:
IllegalArgumentException - when opening was problematic due to exception from the underlying MRecordReader.
Method Detail

computeNext

protected StructureRecord computeNext()
Specified by:
computeNext in class AbstractIterator<StructureRecord>

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

getFormat

public String getFormat()
Get format.

Returns:
Recognized format returned by MRecordReader.getRecognizedFormat()

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)