Package chemaxon.marvin.io
Interface MRecordReader
-
- All Known Implementing Classes:
AbstractMRecordReader
@PublicAPI public interface MRecordReader
Marvin record reader.- Since:
- Marvin 5.0, 04/06/2006
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MRecordReader.Position
Position in the input file.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the input stream.chemaxon.common.util.LongVector
detectRecordPositions(chemaxon.common.util.IntVector linenums)
Detects positions of records in the input stream.MRecordReader
getEncapsulatedReader()
Gets the encapsulated record reader if it exists.long
getFilePointer()
Gets the current position in the input file.String
getFooterAsString()
Gets the footer of the file as a string.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.String
getOptions()
Gets the import options.String
getRecognizedFormat()
Gets the recognized file format.boolean
isPropertyRecord()
boolean
isSeekable()
Tests whether the record reader is seekable.MRecord
nextRecord()
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
setProgressMonitor(MProgressMonitor pmon)
Sets the progress monitor.MRecord
skipRecord()
Skips the next record.
-
-
-
Method Detail
-
setProgressMonitor
void setProgressMonitor(MProgressMonitor pmon)
Sets the progress monitor.- Parameters:
pmon
- the progress monitor
-
nextRecord
MRecord nextRecord() throws MRecordParseException, IOException
Reads the next record.- Returns:
- the record or null at end of file
- Throws:
MRecordParseException
- If the record could not be parsedIOException
- If I/O error occurred
-
skipRecord
MRecord skipRecord() throws MRecordParseException, IOException
Skips the next record.- Returns:
- incomplete record information, only the record start and end positions are guaranteed to be set
- Throws:
MRecordParseException
- If the record could not be parsedIOException
- If I/O error occurred
-
getRecognizedFormat
String getRecognizedFormat()
Gets the recognized file format.- Returns:
- the input file format
-
getHeaderAsString
String getHeaderAsString()
Gets the header of the file as a string.- Returns:
- the header or empty string if there is no header
- Since:
- Marvin 5.0.2, 03/11/2008
-
getFooterAsString
String getFooterAsString()
Gets the footer of the file as a string.- Returns:
- the footer or empty string if there is no footer or not yet read
- Since:
- Marvin 5.0.2, 03/11/2008
-
getOptions
String getOptions()
Gets the import options.- Returns:
- the import options
-
close
void close() throws IOException
Closes the input stream.- Throws:
IOException
- If I/O error occurred
-
getEncapsulatedReader
MRecordReader getEncapsulatedReader()
Gets the encapsulated record reader if it exists. For example, in case of a GZIPped, BASE64 encoded molfile, the GzipRecordReader has an encapsulated Base64RecordReader instance.- Returns:
- the encapsulated record reader or
null
-
getMolInputStream
MolInputStream getMolInputStream()
Gets the molecule input stream.- Returns:
- the molecule input stream
-
getFilePointer
long getFilePointer()
Gets the current position in the input file.- Returns:
- the position
-
getLineCount
int getLineCount()
Get the current line number.- Returns:
- the line number
-
isSeekable
boolean isSeekable()
Tests whether the record reader is seekable.- Returns:
true
if it is seekable,false
otherwise
-
seek
void seek(long p, int lcount, int k) throws IOException
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.- Parameters:
p
- the file pointerlcount
- the line count at the specified positionk
- the record count at the specified position- Throws:
IOException
- ifpos
is less than0
or if an I/O error occurs.
-
isPropertyRecord
boolean isPropertyRecord()
-
detectRecordPositions
chemaxon.common.util.LongVector detectRecordPositions(chemaxon.common.util.IntVector linenums) throws MolFormatException
Detects positions of records in the input stream. Optionally returns also with the line number of records.- Parameters:
linenums
- If not null, stores start line numbers of records in this container.- Returns:
- container with start and end positions of records (inpair elements describe starting, pairs the ending positions).
- Throws:
MolFormatException
-
-