@PublicAPI public class MRecordImporter extends java.lang.Object
setThreadCount(int)
.Constructor and Description |
---|
MRecordImporter(MolInputStream in,
java.lang.String opts)
Creates a reader for the specified molecule input stream in concurrent mode.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the input stream.
|
static MolImportModule |
createImportMod(MolInputStream mis)
Creates an importer for the specified molecule input stream.
|
static MolImportModule |
createImportMod(java.lang.String fmt)
Creates an importer for the specified molecule format.
|
Molecule |
createMol()
Creates an empty target molecule for import.
|
Molecule |
createMolIfNeeded()
Creates an empty target molecule for import if non-concurrent mode,
returns
null if concurrent mode. |
long |
getFilePointer()
Gets the current position in the input file.
|
java.lang.String |
getFormat()
Gets the file format.
|
MPropertyContainer |
getGlobalProperties()
Gets the global properties.
|
int |
getLineCount()
Gets the current line number in the input file.
|
java.lang.String |
getMoleculeString()
Gets the last molecule as a string.
|
MolImportModule |
getMolImportModule() |
java.lang.String |
getOptions()
Gets the options for the import module.
|
boolean |
getQueryMode()
Gets the query mode.
|
MRecordReader |
getRecordReader()
Gets the record reader.
|
boolean |
isSeekable()
Tests whether the record reader is seekable.
|
long |
length()
Gets the length of the input file.
|
MDocument |
readDoc()
Reads the next document.
|
Molecule |
readMol(Molecule mol)
Reads the next molecule.
|
MDocument |
readMolMovie(MDocument doc)
Reads molecules as a movie.
|
Molecule |
readMultiSet(Molecule m)
Reads molecules as one multi-set molecule.
|
java.lang.String |
readRecordAsText()
Reads the next record.
|
void |
seek(long p,
int lcount,
int k)
Sets the file-pointer offset, measured from the beginning of this
file, at which the next read or write occurs.
|
void |
setOptions(java.lang.String opts)
Sets the options for the import module.
|
void |
setProgressMonitor(MProgressMonitor pmon)
Sets the progress monitor.
|
void |
setQueryMode(boolean q)
Sets the query mode.
|
void |
setThreadCount(int threadCount)
Sets the number of threads for concurrent processing.
|
MRecord |
skipRecord()
Skips the next document.
|
public MRecordImporter(MolInputStream in, java.lang.String opts) throws MolFormatException, java.io.IOException
in
- the molecule input streamopts
- input options or null
MolFormatException
- If the format is not recognizablejava.io.IOException
- If I/O error occurredjava.nio.charset.IllegalCharsetNameException
- if illegal encoding is usedjava.nio.charset.UnsupportedCharsetException
- if unsupported encoding is usedpublic void setThreadCount(int threadCount) throws java.lang.IllegalStateException
1
CPU.
Note, that in concurrent mode the import is not rewindable.threadCount
- the number of threads, set 0
for the number of CPUs,
1
for single-threaded modejava.lang.IllegalStateException
- if called after isSeekable()
or
readMol(chemaxon.struc.Molecule)
or readDoc()
.public void setProgressMonitor(MProgressMonitor pmon)
pmon
- the progress monitorpublic static MolImportModule createImportMod(MolInputStream mis) throws java.io.IOException, MolFormatException
mis
- the molecule input streamMolFormatException
- If the format is not recognizablejava.io.IOException
- If I/O error occurredpublic static MolImportModule createImportMod(java.lang.String fmt) throws java.io.IOException, MolFormatException
fmt
- the molecule formatMolFormatException
- If the format is not recognizablejava.io.IOException
- If I/O error occurredpublic java.lang.String getOptions()
public void setOptions(java.lang.String opts)
opts
- options passed to the import module or null
java.lang.IllegalStateException
- if called after
readMol(chemaxon.struc.Molecule)
or readDoc()
.public MDocument readDoc() throws MRecordParseException, MolFormatException, java.io.IOException
null
at end of fileMRecordParseException
- If the record could not be parsedMolFormatException
- If the file format is invalidjava.io.IOException
- If I/O error occurredpublic Molecule readMol(Molecule mol) throws MRecordParseException, MolFormatException, java.io.IOException
null
then processing is
single-threaded.mol
- target object or null
null
at end of fileMRecordParseException
- If the record could not be parsedMolFormatException
- If the file format is invalidjava.io.IOException
- If I/O error occurredpublic Molecule readMultiSet(Molecule m) throws MRecordParseException, MolFormatException, java.io.IOException
m
- the output molecule objectnull
otherwisejava.io.IOException
- cannot read molecule (bad format or I/O error)MRecordParseException
MolFormatException
public MDocument readMolMovie(MDocument doc) throws MolFormatException, java.io.IOException
doc
- the output document object or null
null
otherwiseMolFormatException
- invalid molecule filejava.io.IOException
- cannot read molecule
(bad format or I/O error)public java.lang.String readRecordAsText() throws MRecordParseException, java.io.IOException
null
at end of fileMRecordParseException
- If the record could not be parsedjava.io.IOException
- If I/O error occurredjava.lang.IllegalStateException
- if the concurrent processor is already runningpublic MPropertyContainer getGlobalProperties()
null
public boolean isSeekable()
false
.
Therefore this method should not be called before calling setThreadCount(int)
.true
if it is seekable,
false
otherwisesetThreadCount(int)
public java.lang.String getFormat()
public boolean getQueryMode()
public void setQueryMode(boolean q)
readDoc()
or
readMol(chemaxon.struc.Molecule)
.q
- query modejava.lang.IllegalStateException
- if the concurrent processor is already runningpublic long getFilePointer()
java.lang.IllegalStateException
- if the concurrent processor is runningpublic long length() throws java.io.IOException
java.io.IOException
- if the length cannot be determinedpublic int getLineCount()
public void seek(long p, int lcount, int k) throws java.io.IOException
p
- the file pointerlcount
- the line count at the specified positionk
- the record count at the specified positionjava.io.IOException
- if pos
is less than
0
or if an I/O error occurs.java.lang.UnsupportedOperationException
- if the concurrent processor is runningpublic MRecord skipRecord() throws MRecordParseException, MolFormatException, java.io.IOException
null
if there are no more recordsjava.io.IOException
- If I/O error occurredMRecordParseException
MolFormatException
public void close() throws java.io.IOException
java.io.IOException
- If I/O error occurredpublic MolImportModule getMolImportModule()
public java.lang.String getMoleculeString()
public Molecule createMolIfNeeded()
null
if concurrent mode.null
public Molecule createMol()
public MRecordReader getRecordReader()