@PublicAPI public abstract class AbstractMRecordReader extends java.lang.Object implements MRecordReader
MRecordReader.Position
Modifier | Constructor and Description |
---|---|
|
AbstractMRecordReader(java.io.InputStream istr,
java.lang.String opts)
Constructs an abstract record reader.
|
protected |
AbstractMRecordReader(java.io.InputStream istr,
java.lang.String opts,
java.lang.String path) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendLine(java.lang.StringBuffer sb,
java.lang.String line)
Appends line to string buffer with closing '\n' character.
|
protected void |
appendLines(java.lang.StringBuffer sb,
java.lang.String l)
Appends lines to string buffer with closing '\n' character
if it is not yet present.
|
void |
close()
Interrupts parsing.
|
chemaxon.common.util.LongVector |
detectRecordPositions(chemaxon.common.util.IntVector linenums)
Detects positions of records in the input stream.
|
protected int[] |
endRecord(boolean skip)
It must be called at the end of record.
|
MRecordReader |
getEncapsulatedReader()
Gets the encapsulated record reader if it exists.
|
long |
getFilePointer()
Get the file pointer.
|
java.lang.String |
getFooterAsString()
Gets the footer of the file as a string.
|
java.lang.String |
getHeaderAsString()
Gets the header of the file as a string.
|
int |
getLineCount()
Get the current line number.
|
MolInputStream |
getMolInputStream()
Gets the molecule input stream.
|
java.lang.String |
getOptions()
Gets the import options.
|
protected MRecordReader.Position |
getPosition()
Gets the current position.
|
java.lang.String |
getRecognizedFormat()
Gets the recognized file format.
|
boolean |
isPropertyRecord() |
boolean |
isSeekable()
Tests whether the record reader is seekable.
|
protected void |
putBackLine()
Puts back the previous line to the input stream.
|
protected java.lang.String |
readLine()
Reads the next line.
|
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 |
setProgressMonitor(MProgressMonitor pmon)
Sets the progress monitor.
|
protected boolean |
skipLine()
Skips the next line.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextRecord, skipRecord
public AbstractMRecordReader(java.io.InputStream istr, java.lang.String opts) throws java.io.IOException
istr
- the input streamopts
- format and optionsjava.io.IOException
protected AbstractMRecordReader(java.io.InputStream istr, java.lang.String opts, java.lang.String path) throws java.io.IOException
java.io.IOException
public void setProgressMonitor(MProgressMonitor pmon)
setProgressMonitor
in interface MRecordReader
pmon
- the progress monitorpublic java.lang.String getRecognizedFormat()
getRecognizedFormat
in interface MRecordReader
public java.lang.String getHeaderAsString()
getHeaderAsString
in interface MRecordReader
public java.lang.String getFooterAsString()
getFooterAsString
in interface MRecordReader
public java.lang.String getOptions()
getOptions
in interface MRecordReader
protected java.lang.String readLine() throws java.io.IOException
java.io.IOException
protected boolean skipLine() throws java.io.IOException
true
if a line was skipped successfully,
false
at end of filejava.io.IOException
- If an I/O error has occurred.protected void putBackLine() throws java.io.IOException
java.io.IOException
protected int[] endRecord(boolean skip)
skip
- whether to skip the recordpublic void close()
close
in interface MRecordReader
public MRecordReader getEncapsulatedReader()
getEncapsulatedReader
in interface MRecordReader
null
public MolInputStream getMolInputStream()
getMolInputStream
in interface MRecordReader
public long getFilePointer()
getFilePointer
in interface MRecordReader
public int getLineCount()
getLineCount
in interface MRecordReader
public boolean isSeekable()
isSeekable
in interface MRecordReader
true
if it is seekable,
false
otherwisepublic void seek(long p, int lcount, int k) throws java.io.IOException
seek
in interface MRecordReader
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.protected MRecordReader.Position getPosition()
protected void appendLines(java.lang.StringBuffer sb, java.lang.String l)
sb
- the string bufferl
- the linesprotected void appendLine(java.lang.StringBuffer sb, java.lang.String line)
sb
- the string bufferline
- the linepublic boolean isPropertyRecord()
isPropertyRecord
in interface MRecordReader
public chemaxon.common.util.LongVector detectRecordPositions(chemaxon.common.util.IntVector linenums) throws MolFormatException
detectRecordPositions
in interface MRecordReader
linenums
- If not null, stores start line numbers of records
in this container.MolFormatException