chemaxon.formats
Class MFileFormat

java.lang.Object
  extended by chemaxon.formats.MFileFormat

public class MFileFormat
extends java.lang.Object

File format descriptor class.

Since:
Marvin 5.0, 05/23/2007
Version:
5.1, 07/29/2008
Author:
Peter Csizmadia

Field Summary
static MFileFormat ABBREVGROUP
          ChemAxon SMILES Abbreviated Groups.
static MFileFormat AWT_IMAGE
          Image object (java.awt.Image).
static MFileFormat BASE64
          BASE64 encoded file.
static MFileFormat CML
          Chemical Markup Language.
static MFileFormat CSMDL_IN
          ChemAxon Compressed Molfiles, RGfiles, Rgfiles, SDfiles or RDfiles.
static MFileFormat CSMOL_OUT
          ChemAxon Compressed Molfiles and Rgfiles.
static MFileFormat CSRDF
          ChemAxon Compressed RDfiles.
static MFileFormat CSRXN_OUT
          ChemAxon Compressed Rxnfiles.
static MFileFormat CSSDF_OUT
          ChemAxon Compressed SDfiles.
static MFileFormat CXSMARTS
          ChemAxon Extended SMARTS.
static MFileFormat CXSMILES
          ChemAxon Extended SMILES.
static MFileFormat EMF
          Windows Enhanced Metafiles.
static long F_ARCHIVE
          General archive format that stores a file in another format.
static long F_BINARY
          Import/export module handles binary (byte array) data.
static long F_COORDS
          The format can store atom coordinates if this flag is set.
static long F_EXPORT
          Export is possible if this flag is set.
static long F_GRAPHICS
          File format readable by a graphics program (image viewer, ray tracer etc.).
static long F_IMAGE
          2D image file format, readable by image viewers.
static long F_IMPORT
          Import is possible if this flag is set.
static long F_MIXED
          Storage of records in different formats is possible if this flag is set.
static long F_MOLECULE
          The format can store molecule(s) if this flag is set.
static long F_MULTIPLE_RECORDS_LEGAL
          The format is designed to store multiple records if this flag is set.
static long F_MULTIPLE_RECORDS_POSSIBLE
          The import/export modules can handle files with multiple records if this flag is set.
static long F_OBJECT
          Import/export module creates or reads a java object.
static long F_REACTION
          The format can store reaction(s) if this flag is set.
static long F_RECOGNIZER
          Format recognizer exists if this flag is set.
static long F_SINGLE_LINE
          Format uses one line per structure.
static long F_USER_DEFINED
          User defined format.
static long F_XML
          The format is XML based if this flag is set.
static MFileFormat GAUSSIAN_CUBE
          Gaussian Cube files.
static MFileFormat GAUSSIAN_INPUT
          Gaussian Input Format.
static MFileFormat GZIP
          GZIPped file.
static MFileFormat INCHI
          IUPAC InChI files.
static MFileFormat JPEG
          JPEG format.
static MFileFormat JTF
          JChem Table Format.
static MFileFormat MOL
          MDL Molfiles and Rgfiles.
static MFileFormat MOL_V3_OUT
          MDL Extended Molfiles and Rgfiles.
static MFileFormat MOL2
          Tripos Mol2 files.
static MFileFormat MRV
          Chemaxon Marvin Document.
static MFileFormat MSBMP
          Windows Bitmap format.
static MFileFormat NAME
          IUPAC Name files.
static MFileFormat PDB
          Protein Data Bank format.
static MFileFormat PDF
          Portable Document Format.
static MFileFormat PEPTIDE_IN
          Peptide Sequence.
static MFileFormat PEPTIDE1_OUT
          Peptide Sequence (1-letter).
static MFileFormat PEPTIDE3_OUT
          Peptide Sequence (3-letter).
static MFileFormat PNG
          Portable Network Graphics.
static MFileFormat POVRAY
          POVRay file.
static MFileFormat PPM
          Portable Pixmap format.
static MFileFormat RDF
          MDL RDfiles.
static MFileFormat RXN
          MDL Rxnfiles.
static MFileFormat RXN_V3_OUT
          MDL Extended Rxnfiles.
static MFileFormat SDF
          MDL SDfiles.
static MFileFormat SMARTS
          SMARTS.
static MFileFormat SMILES
          SMILES.
static MFileFormat SVG
          Scalable Vector Graphics.
static MFileFormat SYBYLMOL
          Tripos SYBYL molfiles.
static MFileFormat XYZ
          XYZ files.
 
Constructor Summary
MFileFormat(java.lang.String desc, java.lang.String format, java.lang.String mime, java.lang.String exts, java.lang.String rrname, java.lang.String impname, java.lang.String expname, java.lang.String recogn, long f)
          Creates a format descriptor.
 
Method Summary
 MolExportModule createExportModule()
          Creates the export module.
 MolImportModule createImportModule()
          Creates the molecule import module.
 Recognizer createRecognizer(java.lang.String fmt)
          Creates a recognizer module.
 MRecordReader createRecordReader(MolInputStream mis, java.lang.String opts)
          Creates the record reader.
 MFileFormat getAssociatedNonQueryFormat()
          Gets the associated non-query format.
 MFileFormat getAssociatedQueryFormat()
          Gets the associated query format.
 java.lang.String getDescription()
          Gets the format description.
 java.lang.String[] getExtensions()
          Gets the extension list.
 long getFlags()
          Gets the format descriptor flags.
 java.lang.String getMIMEType()
          Gets the MIME type.
 java.lang.String getName()
          Gets the codename of the format.
 java.lang.String[] getNames()
          Gets all the codename of the format.
 int getPriority(java.lang.String subfmt)
          Gets the priority determining format recognition order.
 boolean isFlagSet(long flag)
          Checks whether the format has a given (set of) flag(s) set.
 boolean matches(java.lang.String fmt, long f, long mask)
          Tests whether the format matches the specified pattern.
 java.lang.String toString()
          Overrides Object.toString() to ease debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MRV

public static final MFileFormat MRV
Chemaxon Marvin Document.


CML

public static final MFileFormat CML
Chemical Markup Language.


MOL

public static final MFileFormat MOL
MDL Molfiles and Rgfiles.


MOL_V3_OUT

public static final MFileFormat MOL_V3_OUT
MDL Extended Molfiles and Rgfiles.


RXN

public static final MFileFormat RXN
MDL Rxnfiles.


RXN_V3_OUT

public static final MFileFormat RXN_V3_OUT
MDL Extended Rxnfiles.


SDF

public static final MFileFormat SDF
MDL SDfiles.


RDF

public static final MFileFormat RDF
MDL RDfiles.


JTF

public static final MFileFormat JTF
JChem Table Format.


CSMDL_IN

public static final MFileFormat CSMDL_IN
ChemAxon Compressed Molfiles, RGfiles, Rgfiles, SDfiles or RDfiles. Format object for import only.


CSMOL_OUT

public static final MFileFormat CSMOL_OUT
ChemAxon Compressed Molfiles and Rgfiles.


CSRXN_OUT

public static final MFileFormat CSRXN_OUT
ChemAxon Compressed Rxnfiles.


CSSDF_OUT

public static final MFileFormat CSSDF_OUT
ChemAxon Compressed SDfiles.


CSRDF

public static final MFileFormat CSRDF
ChemAxon Compressed RDfiles.


SMILES

public static final MFileFormat SMILES
SMILES.


SMARTS

public static final MFileFormat SMARTS
SMARTS.


CXSMILES

public static final MFileFormat CXSMILES
ChemAxon Extended SMILES.


CXSMARTS

public static final MFileFormat CXSMARTS
ChemAxon Extended SMARTS.


ABBREVGROUP

public static final MFileFormat ABBREVGROUP
ChemAxon SMILES Abbreviated Groups.


INCHI

public static final MFileFormat INCHI
IUPAC InChI files.


NAME

public static final MFileFormat NAME
IUPAC Name files.


PEPTIDE_IN

public static final MFileFormat PEPTIDE_IN
Peptide Sequence.


PEPTIDE1_OUT

public static final MFileFormat PEPTIDE1_OUT
Peptide Sequence (1-letter).


PEPTIDE3_OUT

public static final MFileFormat PEPTIDE3_OUT
Peptide Sequence (3-letter).


XYZ

public static final MFileFormat XYZ
XYZ files.


GAUSSIAN_CUBE

public static final MFileFormat GAUSSIAN_CUBE
Gaussian Cube files.


GAUSSIAN_INPUT

public static final MFileFormat GAUSSIAN_INPUT
Gaussian Input Format.


SYBYLMOL

public static final MFileFormat SYBYLMOL
Tripos SYBYL molfiles.


MOL2

public static final MFileFormat MOL2
Tripos Mol2 files.


PDB

public static final MFileFormat PDB
Protein Data Bank format.


GZIP

public static final MFileFormat GZIP
GZIPped file.


BASE64

public static final MFileFormat BASE64
BASE64 encoded file.


AWT_IMAGE

public static final MFileFormat AWT_IMAGE
Image object (java.awt.Image).


JPEG

public static final MFileFormat JPEG
JPEG format.


PNG

public static final MFileFormat PNG
Portable Network Graphics.


PPM

public static final MFileFormat PPM
Portable Pixmap format.


MSBMP

public static final MFileFormat MSBMP
Windows Bitmap format.


PDF

public static final MFileFormat PDF
Portable Document Format.


SVG

public static final MFileFormat SVG
Scalable Vector Graphics.


EMF

public static final MFileFormat EMF
Windows Enhanced Metafiles.


POVRAY

public static final MFileFormat POVRAY
POVRay file.


F_EXPORT

public static final long F_EXPORT
Export is possible if this flag is set.

See Also:
Constant Field Values

F_IMPORT

public static final long F_IMPORT
Import is possible if this flag is set.

See Also:
Constant Field Values

F_RECOGNIZER

public static final long F_RECOGNIZER
Format recognizer exists if this flag is set. Automatically set by the constructor if the recognizer argument is not null.

See Also:
Constant Field Values

F_BINARY

public static final long F_BINARY
Import/export module handles binary (byte array) data.

See Also:
Constant Field Values

F_OBJECT

public static final long F_OBJECT
Import/export module creates or reads a java object.

See Also:
Constant Field Values

F_MOLECULE

public static final long F_MOLECULE
The format can store molecule(s) if this flag is set.

See Also:
Constant Field Values

F_REACTION

public static final long F_REACTION
The format can store reaction(s) if this flag is set.

See Also:
Constant Field Values

F_ARCHIVE

public static final long F_ARCHIVE
General archive format that stores a file in another format.

See Also:
Constant Field Values

F_GRAPHICS

public static final long F_GRAPHICS
File format readable by a graphics program (image viewer, ray tracer etc.).

See Also:
Constant Field Values

F_IMAGE

public static final long F_IMAGE
2D image file format, readable by image viewers.

See Also:
Constant Field Values

F_COORDS

public static final long F_COORDS
The format can store atom coordinates if this flag is set.

See Also:
Constant Field Values

F_MULTIPLE_RECORDS_LEGAL

public static final long F_MULTIPLE_RECORDS_LEGAL
The format is designed to store multiple records if this flag is set.

See Also:
Constant Field Values

F_MULTIPLE_RECORDS_POSSIBLE

public static final long F_MULTIPLE_RECORDS_POSSIBLE
The import/export modules can handle files with multiple records if this flag is set.

See Also:
Constant Field Values

F_MIXED

public static final long F_MIXED
Storage of records in different formats is possible if this flag is set.

See Also:
Constant Field Values

F_XML

public static final long F_XML
The format is XML based if this flag is set.

See Also:
Constant Field Values

F_USER_DEFINED

public static final long F_USER_DEFINED
User defined format.

See Also:
Constant Field Values

F_SINGLE_LINE

public static final long F_SINGLE_LINE
Format uses one line per structure.

Since:
Marvin 5.1
See Also:
Constant Field Values
Constructor Detail

MFileFormat

public MFileFormat(java.lang.String desc,
                   java.lang.String format,
                   java.lang.String mime,
                   java.lang.String exts,
                   java.lang.String rrname,
                   java.lang.String impname,
                   java.lang.String expname,
                   java.lang.String recogn,
                   long f)
Creates a format descriptor. The recogn argument specifies the recognizer module name and the priority of the format, separated by a space. If the format has more than one subformats, then their priorities are specified here in the form "format1=priority1 format2=priority2 ...".

Parameters:
desc - the format description
format - the format
mime - the MIME type or null if unknown
exts - the file extensions separated by spaces
rrname - name of the record reader module
impname - name of the import module
expname - name of the export module
recogn - the file format recognizer module name and the priority (nonnegative integer)
f - the flags
Method Detail

getName

public java.lang.String getName()
Gets the codename of the format.

Returns:
the codename.

getNames

public java.lang.String[] getNames()
Gets all the codename of the format.

Returns:
the codename.

getDescription

public java.lang.String getDescription()
Gets the format description.

Returns:
the description.

getExtensions

public java.lang.String[] getExtensions()
Gets the extension list.

Returns:
the extension list

getMIMEType

public java.lang.String getMIMEType()
Gets the MIME type.

Returns:
the MIME type or null if unknown

getFlags

public long getFlags()
Gets the format descriptor flags.

Returns:
the flags

getAssociatedQueryFormat

public MFileFormat getAssociatedQueryFormat()
Gets the associated query format.

Returns:
the associated format or null

getAssociatedNonQueryFormat

public MFileFormat getAssociatedNonQueryFormat()
Gets the associated non-query format.

Returns:
the associated format or null

getPriority

public int getPriority(java.lang.String subfmt)
Gets the priority determining format recognition order.

Parameters:
subfmt - the name of the subformat or null
Returns:
zero or a positive number
Throws:
java.lang.IllegalArgumentException - if priority for the specified subformat is not defined
Since:
Marvin 5.1, 07/29/2008

matches

public boolean matches(java.lang.String fmt,
                       long f,
                       long mask)
Tests whether the format matches the specified pattern.

Parameters:
fmt - the format name or null if not important
f - these flags must be set
mask - only bits specified here are taken into account
Returns:
true if it matches, false otherwise

isFlagSet

public boolean isFlagSet(long flag)
Checks whether the format has a given (set of) flag(s) set.

Parameters:
flag - the flag (or set of flags) to be test
Returns:
true if (all of) the given flag(s) is set, false otherwise
Since:
Marvin 5.1

createRecordReader

public MRecordReader createRecordReader(MolInputStream mis,
                                        java.lang.String opts)
                                 throws MolFormatException
Creates the record reader.

Parameters:
mis - the molecule input stream
opts - the options or null
Returns:
the record reader or null if there is no record reader for this format
Throws:
java.nio.charset.IllegalCharsetNameException - if illegal encoding is used
java.nio.charset.UnsupportedCharsetException - if unsupported encoding is used
java.lang.SecurityException - if the module cannot be loaded because of a firewall problem
MolFormatException
See Also:
MFileFormatUtil.createRecordReader(InputStream, String)

createImportModule

public MolImportModule createImportModule()
                                   throws MolFormatException
Creates the molecule import module.

Returns:
the molecule import module or null if there is no importer for this format
Throws:
java.lang.SecurityException - if the module cannot be loaded because of a firewall problem
MolFormatException

createExportModule

public MolExportModule createExportModule()
                                   throws MolExportException
Creates the export module.

Returns:
the molecul export module or null if there is no exporter for this format
Throws:
java.lang.SecurityException - if the module cannot be loaded because of a firewall problem
MolExportException
See Also:
MFileFormatUtil.createExportModule(String)

createRecognizer

public Recognizer createRecognizer(java.lang.String fmt)
                            throws MolFormatException
Creates a recognizer module.

Parameters:
fmt - the (sub)format's codename
Returns:
the recognizer module or null if there is no recognizer for this format
Throws:
java.lang.SecurityException - if the module cannot be loaded because of a firewall problem
MolFormatException - if the recognizer module cannot be created

toString

public java.lang.String toString()
Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@', the unsigned hexadecimal representation of the hash code of the object and the format name(s) in square brackets.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object