Package chemaxon.marvin.io
Class MRecord
- java.lang.Object
-
- chemaxon.marvin.io.MRecord
-
@PublicAPI public class MRecord extends Object
Record in a multi-molecule file.- Since:
- Marvin 5.0, 04/06/2006
-
-
Field Summary
Fields Modifier and Type Field Description static int
F_MOL_MISSING
Molecule (or reaction) is missing from the record.protected long
fileEndPosition
protected long
fileStartPosition
protected MPropertyContainer
properties
-
Constructor Summary
Constructors Constructor Description MRecord()
Default constructor.MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap)
Creates a record.MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap, int descflags)
Creates a record.MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap, int descflags, String moleculeName)
Creates a record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEncoding()
Gets the encoding.int
getEndLineCount()
Gets the line number at the ending point.long
getEndPosition()
Gets the end position in the input file.int
getFlags()
Gets the record descriptor flags.String
getFormat()
Gets the full format string of the record.int
getHeaderNewLineCount()
Gets the number of new lines in the molecule header part.String
getInputFormat()
Gets the input format.int[]
getLineNumberMap()
Gets the line number to original line number mapping.byte[]
getMolBytes()
Gets the molecule bytes, with preprended header and appended footer if appropriate.String
getMoleculeName()
Returns the name of the molecule in the record.String
getMolString()
Gets the molecule string, with preprended header and appended footer if appropriate.MPropertyContainer
getPropertyContainer()
Gets the properties.int
getStartLineCount()
Gets the line number at the starting point.long
getStartPosition()
Gets the start position in the input file.String
getString()
Gets the record text as string.void
setMolBytes(byte[] molBytes)
Sets the molecule bytes.
-
-
-
Field Detail
-
F_MOL_MISSING
public static final int F_MOL_MISSING
Molecule (or reaction) is missing from the record. This record descriptor flag is set if the molecule part of the record contains only a registry number ("MIREG", "MEREG", "RIREG" or "REREG") in case of an RDfile.- Since:
- Marvin 5.0.3, 03/20/2008
- See Also:
getFlags()
, Constant Field Values
-
fileStartPosition
protected long fileStartPosition
-
fileEndPosition
protected long fileEndPosition
-
properties
protected MPropertyContainer properties
-
-
Constructor Detail
-
MRecord
public MRecord()
Default constructor.- Since:
- Marvin 5.2
-
MRecord
public MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap)
Creates a record.- Parameters:
start
- the start position in input fileend
- the end position in input filelineno
- the line number at the starting points
- the record stringp
- the propertieslmap
- original line numbers
-
MRecord
public MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap, int descflags)
Creates a record.- Parameters:
start
- the start position in input fileend
- the end position in input filelineno
- the line number at the starting points
- the record stringp
- the propertieslmap
- original line numbersdescflags
- extra record descriptor flags
-
MRecord
public MRecord(long start, long end, int lineno, String s, MPropertyContainer p, int[] lmap, int descflags, String moleculeName)
Creates a record.- Parameters:
start
- the start position in input fileend
- the end position in input filelineno
- the line number at the starting points
- the record stringp
- the propertieslmap
- original line numbersdescflags
- extra record descriptor flagsmoleculeName
- name of the molecule- Since:
- Marvin 5.0.3, 03/20/2008
-
-
Method Detail
-
getEncoding
public String getEncoding()
Gets the encoding.- Returns:
- the encoding
- Since:
- Marvin 5.3
-
getMolString
public String getMolString()
Gets the molecule string, with preprended header and appended footer if appropriate. This string can be imported to get a valid molecule.- Returns:
- the molecule string
- Since:
- Marvin 5.3
-
setMolBytes
public void setMolBytes(byte[] molBytes)
Sets the molecule bytes. Used for binary formats, otherwisesetMolString(java.lang.String)
is called to set the mol string.- Parameters:
molBytes
- the molecule bytes
-
getMolBytes
public byte[] getMolBytes()
Gets the molecule bytes, with preprended header and appended footer if appropriate. This byte array can be imported to get a valid molecule. Only used for binary formats, otherwise callgetMolString()
.- Returns:
- the molecule string
- Since:
- Marvin 5.4
-
getHeaderNewLineCount
public int getHeaderNewLineCount()
Gets the number of new lines in the molecule header part.- Returns:
- the number of new lines in the molecule header part
- Since:
- Marvin 5.3
-
getFormat
public String getFormat()
Gets the full format string of the record. E.g. for a gzipped mrv it returns "gzip:mrv".- Returns:
- the format of the record as a string.
-
getInputFormat
public String getInputFormat()
Gets the input format. This the format of the file. E.g for a gzipped mrv it returns "mrv"- Returns:
- the input format
- Since:
- Marvin 5.3
-
getString
public String getString()
Gets the record text as string. Note that the returned string is not guaranteed to be a valid molecule file. Prepend the molecule file header and append the footer to get an importable file.- Returns:
- the text
- See Also:
MRecordReader.getHeaderAsString()
,MRecordReader.getFooterAsString()
,getMolString()
-
getPropertyContainer
public MPropertyContainer getPropertyContainer()
Gets the properties.- Returns:
- the properties
-
getLineNumberMap
public int[] getLineNumberMap()
Gets the line number to original line number mapping.- Returns:
- the mapping
-
getStartPosition
public long getStartPosition()
Gets the start position in the input file.- Returns:
- the position
-
getEndPosition
public long getEndPosition()
Gets the end position in the input file.- Returns:
- the position
-
getStartLineCount
public int getStartLineCount()
Gets the line number at the starting point.- Returns:
- the line number
-
getEndLineCount
public int getEndLineCount()
Gets the line number at the ending point.- Returns:
- the line number
- Since:
- Marvin 5.3
-
getFlags
public int getFlags()
Gets the record descriptor flags.- Returns:
- the record descriptor flags
- Since:
- Marvin 5.0.3, 03/20/2008
- See Also:
F_MOL_MISSING
-
getMoleculeName
public String getMoleculeName()
Returns the name of the molecule in the record.- Returns:
- the name or an empty string if it's not specified
- Since:
- Marvin 6.3
-
-