chemaxon.marvin.io
Class MRecord

java.lang.Object
  extended by chemaxon.marvin.io.MRecord

public class MRecord
extends java.lang.Object

Record in a multi-molecule file.

Since:
Marvin 5.0, 04/06/2006
Version:
5.0.3, 03/20/2008
Author:
Peter Csizmadia

Field Summary
static int F_MOL_MISSING
          Molecule (or reaction) is missing from the record.
protected  long fileEndPosition
           
protected  long fileStartPosition
           
protected  MPropertyContainer properties
           
 
Constructor Summary
MRecord()
          Default constructor.
MRecord(long start, long end, int lineno, java.lang.String s, MPropertyContainer p, int[] lmap)
          Creates a record.
MRecord(long start, long end, int lineno, java.lang.String s, MPropertyContainer p, int[] lmap, int descflags)
          Creates a record.
 
Method Summary
 java.lang.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.
 java.lang.String getFormat()
           
 int getHeaderNewLineCount()
          Gets the number of new lines in the molecule header part.
 java.lang.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.
 java.lang.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.
 java.lang.String getString()
          Gets the record text as string.
 void setMolBytes(byte[] molBytes)
          Sets the molecule bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
               java.lang.String s,
               MPropertyContainer p,
               int[] lmap)
Creates a record.

Parameters:
start - the start position in input file
end - the end position in input file
lineno - the line number at the starting point
s - the record string
p - the properties
lmap - original line numbers

MRecord

public MRecord(long start,
               long end,
               int lineno,
               java.lang.String s,
               MPropertyContainer p,
               int[] lmap,
               int descflags)
Creates a record.

Parameters:
start - the start position in input file
end - the end position in input file
lineno - the line number at the starting point
s - the record string
p - the properties
lmap - original line numbers
descflags - extra record descriptor flags
Since:
Marvin 5.0.3, 03/20/2008
Method Detail

getEncoding

public java.lang.String getEncoding()
Gets the encoding.

Returns:
the encoding
Since:
Marvin 5.3

getMolString

public java.lang.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, otherwise setMolString(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 call getMolString().

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 java.lang.String getFormat()

getInputFormat

public java.lang.String getInputFormat()
Gets the input format.

Returns:
the input format
Since:
Marvin 5.3

getString

public java.lang.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
Throws:
IOException - If I/O error occured
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