Class MFileFormat


  • @PublicAPI
    public class MFileFormat
    extends Object
    File format descriptor class.
    Since:
    Marvin 5.0, 05/23/2007
    • Field Detail

      • MRV

        public static final MFileFormat MRV
        Chemaxon Marvin Document.
      • CML

        public static final MFileFormat CML
        Chemical Markup Language.
      • CXON

        public static final MFileFormat CXON
        Chemaxon Object Notation.
      • MOL

        public static final MFileFormat MOL
        MDL Molfiles and Rgfiles.
      • MOL_V2_OUT

        public static final MFileFormat MOL_V2_OUT
      • 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.
      • 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.
      • INCHIKEY

        public static final MFileFormat INCHIKEY
        IUPAC InChIKey.
      • 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).
      • RNA

        public static final MFileFormat RNA
        RNA sequence.
      • DNA

        public static final MFileFormat DNA
        DNA sequence.
      • GAUSSIAN_CUBE

        public static final MFileFormat GAUSSIAN_CUBE
        Gaussian Cube files.
      • GAUSSIAN_INPUT

        public static final MFileFormat GAUSSIAN_INPUT
        Gaussian Input Format.
      • GAUSSIAN_INPUTZ

        public static final MFileFormat GAUSSIAN_INPUTZ
        Gaussian Input Format: Z-matrix.
      • GAUSSIAN_OUTPUT

        public static final MFileFormat GAUSSIAN_OUTPUT
        Gaussian output 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.
      • 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.
      • EPS

        public static final MFileFormat EPS
        Encapsulated PostScript vector image format.
      • TIFF

        public static final MFileFormat TIFF
        Tagged Image File Format.
      • EMF

        public static final MFileFormat EMF
        Windows Enhanced Metafiles.
      • POVRAY

        public static final MFileFormat POVRAY
        POVRay file.
      • CDX

        public static final MFileFormat CDX
        ChemDraw CDX file.
      • CDXML

        public static final MFileFormat CDXML
        ChemDraw CDXML file.
      • D2S

        public static final MFileFormat D2S
        Any document format recognized by Document to Structure (doc, odt, ...).
      • FASTA

        public static final MFileFormat FASTA
        FASTA file format
      • FASTA_DNA

        public static final MFileFormat FASTA_DNA
        FASTA file format with DNA sequence
      • FASTA_RNA

        public static final MFileFormat FASTA_RNA
        FASTA file format with RNA sequence
      • FASTA_PEPTIDE

        public static final MFileFormat FASTA_PEPTIDE
        FASTA file format with peptide sequence
      • SKC

        public static final MFileFormat SKC
        SKC file format
      • ACCORD

        public static final MFileFormat ACCORD
        ACCORD file format
      • 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, but according to the format definition it is not legal. Other programs may not import multiple records just the first one.
        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​(String desc,
                           String format,
                           String mime,
                           String exts,
                           String rrname,
                           String impname,
                           String expname,
                           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 String getName()
        Gets the codename of the format.
        Returns:
        the codename
      • getNames

        public String[] getNames()
        Gets all the codenames of the format.
        Returns:
        the codenames
      • getDescription

        public String getDescription()
        Gets the format description.
        Returns:
        the description
      • getExtensions

        public String[] getExtensions()
        Gets the extension list.
        Returns:
        the extension list
      • getMIMEType

        @Deprecated
        public String getMIMEType()
        Deprecated.
        as of Marvin 2014.07.21.0 not used
        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

        @Deprecated
        public int getPriority​(String subfmt)
        Deprecated.
        as of Marvin 2014.07.21.0 use getSubFormatPriority(String) instead
        Gets the priority determining format recognition order.
        Parameters:
        subfmt - the name of the subformat or null
        Returns:
        zero or a positive number
        Throws:
        IllegalArgumentException - if priority for the specified subformat is not defined
        Since:
        Marvin 5.1, 07/29/2008
      • getSubFormatPriority

        public static int getSubFormatPriority​(String subFormatName)
        Gets the priority of the specified subformat name.
        Parameters:
        subFormatName - the name of the subformat
        Returns:
        zero or a positive number
        Throws:
        IllegalArgumentException - if priority for the specified subformat is not defined
        Since:
        Marvin 5.1, 07/29/2008
      • matches

        public boolean matches​(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
      • createRecognizer

        public Recognizer createRecognizer()
                                    throws MolFormatException
        Creates a recognizer module.
        Returns:
        the recognizer module or null if there is no recognizer for this format
        Throws:
        SecurityException - if the module cannot be loaded because of a firewall problem
        MolFormatException - if the recognizer module cannot be created
      • toString

        public 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 Object
        Returns:
        a string representation of the object