Package org.openscience.cdk.io.random
Class RandomAccessSDFReader
- java.lang.Object
-
- org.openscience.cdk.io.random.DefaultRandomAccessChemObjectReader
-
- org.openscience.cdk.io.random.RandomAccessReader
-
- org.openscience.cdk.io.random.RandomAccessSDFReader
-
- All Implemented Interfaces:
Iterator<IChemObject>
,ListIterator<IChemObject>
,IRandomAccessChemObjectReader<IChemObject>
public class RandomAccessSDFReader extends RandomAccessReader
Random access of SDF file. Doesn't load molecules in memory, uses prebuilt index and seeks to find the correct record offset.- Author:
- Nina Jeliazkova <nina@acad.bg>
- Source code:
- main
- Belongs to CDK module:
- io
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.io.random.RandomAccessReader
b, builder, chemObjectReader, currentRecord, headerOptions, index, indexCreated, indexVersion, logger, raFile, records
-
Fields inherited from class org.openscience.cdk.io.random.DefaultRandomAccessChemObjectReader
mode
-
-
Constructor Summary
Constructors Constructor Description RandomAccessSDFReader(File file, IChemObjectBuilder builder)
RandomAccessSDFReader(File file, IChemObjectBuilder builder, IReaderListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(Class<? extends IChemObject> classObject)
ISimpleChemObjectReader
createChemObjectReader()
IResourceFormat
getFormat()
protected boolean
isRecordEnd(String line)
protected IChemObject
processContent()
The reader is already set to read the record buffer.void
remove()
void
setReader(InputStream reader)
void
setReader(Reader reader)
-
Methods inherited from class org.openscience.cdk.io.random.RandomAccessReader
add, addChemObjectIOListener, close, finalize, first, getChemObjectReader, getCurrentRecord, getIndexFile, hasNext, hasPrevious, isIndexCreated, last, loadIndex, makeIndex, next, nextIndex, previous, previousIndex, readContent, readRecord, removeChemObjectIOListener, resize, saveIndex, set, setChemObjectReader, setIndexCreated, size, toString
-
Methods inherited from class org.openscience.cdk.io.random.DefaultRandomAccessChemObjectReader
fireIOSettingQuestion, getIOSettings, setReaderMode
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
RandomAccessSDFReader
public RandomAccessSDFReader(File file, IChemObjectBuilder builder) throws IOException
- Parameters:
file
-builder
-- Throws:
IOException
-
RandomAccessSDFReader
public RandomAccessSDFReader(File file, IChemObjectBuilder builder, IReaderListener listener) throws IOException
- Throws:
IOException
-
-
Method Detail
-
createChemObjectReader
public ISimpleChemObjectReader createChemObjectReader()
- Specified by:
createChemObjectReader
in classRandomAccessReader
-
isRecordEnd
protected boolean isRecordEnd(String line)
- Specified by:
isRecordEnd
in classRandomAccessReader
-
getFormat
public IResourceFormat getFormat()
-
processContent
protected IChemObject processContent() throws CDKException
Description copied from class:RandomAccessReader
The reader is already set to read the record buffer.- Overrides:
processContent
in classRandomAccessReader
- Returns:
- the read IChemObject
- Throws:
CDKException
- an error occurred whilst reading the file
-
setReader
public void setReader(Reader reader) throws CDKException
- Throws:
CDKException
-
setReader
public void setReader(InputStream reader) throws CDKException
- Throws:
CDKException
-
accepts
public boolean accepts(Class<? extends IChemObject> classObject)
-
remove
public void remove()
-
-