Class MFileFormat

java.lang.Object
chemaxon.formats.MFileFormat

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

    • 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.
    • 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.
    • 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
      GZIP compressed 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.
    • OSRA

      public static final MFileFormat OSRA
    • 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
    • CSV

      public static final MFileFormat CSV
    • VMN

      public static final MFileFormat VMN
    • F_EXPORT

      public static final long F_EXPORT
      Export is possible if this flag is set.
      See Also:
    • F_IMPORT

      public static final long F_IMPORT
      Import is possible if this flag is set.
      See Also:
    • 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:
    • F_BINARY

      public static final long F_BINARY
      Import/export module handles binary (byte array) data.
      See Also:
    • F_OBJECT

      public static final long F_OBJECT
      Import/export module creates or reads a java object.
      See Also:
    • F_MOLECULE

      public static final long F_MOLECULE
      The format can store molecule(s) if this flag is set.
      See Also:
    • F_REACTION

      public static final long F_REACTION
      The format can store reaction(s) if this flag is set.
      See Also:
    • F_ARCHIVE

      public static final long F_ARCHIVE
      General archive format that stores a file in another format.
      See Also:
    • F_GRAPHICS

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

      public static final long F_IMAGE
      2D image file format, readable by image viewers.
      See Also:
    • F_COORDS

      public static final long F_COORDS
      The format can store atom coordinates if this flag is set.
      See Also:
    • 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:
    • F_MIXED

      public static final long F_MIXED
      Storage of records in different formats is possible if this flag is set.
      See Also:
    • F_XML

      public static final long F_XML
      The format is XML based if this flag is set.
      See Also:
    • F_USER_DEFINED

      public static final long F_USER_DEFINED
      User defined format.
      See Also:
    • F_SINGLE_LINE

      public static final long F_SINGLE_LINE
      Format uses one line per structure.
      Since:
      Marvin 5.1
      See Also:
  • Constructor Details

  • Method Details

    • createUserDefined

      public static MFileFormat createUserDefined(String description, String formats, String extensions, MRecordReaderFactory recordReaderFactory, MolImportModuleFactory importModuleFactory, MolExportModuleFactory exportModuleFactory, RecognizerFactory recognizerFactory, String subformatPriorities, long flags)
      Creates a user-defined format descriptor. The F_USER_DEFINED flag is automatically set.
      Parameters:
      description - the format description
      formats - the format or subformats separated by spaces
      extensions - the file extensions separated by spaces
      recordReaderFactory - factory for the record reader module, or null
      recordReaderFactory - factory for the import module, or null
      exportModuleFactory - factory for the export module, or null
      recognizerFactory - factory for the recognizer module, or null
      subformatPriorities - the priority of the format (nonnegative integer). If the format has more than one subformats, then their priorities are specified here in the form "format1=priority1 format2=priority2 ...".
      flags - the flags
    • createUserDefined

      public static MFileFormat createUserDefined(String description, List<String> formats, List<String> extensions, MRecordReaderFactory recordReaderFactory, MolImportModuleFactory importModuleFactory, MolExportModuleFactory exportModuleFactory, RecognizerFactory recognizerFactory, Map<String,Integer> subformatPriorities, long flags)
      Creates a user-defined format descriptor. The F_USER_DEFINED flag is automatically set.
      Parameters:
      description - the format description
      formats - the list of formats
      extensions - the list of file extensions
      recordReaderFactory - factory for the record reader and import modules, or null
      exportModuleFactory - factory for the export module, or null
      recognizerFactory - factory for the recognizer module, or null
      subformatPriorities - a map of each subformat to its priority, or null
      flags - the flags
    • getName

      public String getName()
      Gets the codename of the format.
      Returns:
      the codename
    • getNameList

      public List<String> getNameList()
      Gets all the codenames of the format.
      Returns:
      the codenames
    • getNames

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getNameList() instead.
      Gets all the codenames of the format.
      Returns:
      the codenames
    • getDescription

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

      public List<String> getExtensionList()
      Gets the extension list.
      Returns:
      the extension list
    • getExtensions

      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the extension list.
      Returns:
      the extension list
    • getMIMEType

      Deprecated, for removal: This API element is subject to removal in a future version.
      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(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public int getPriority(String subfmt)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • createRecordReader

      public MRecordReader createRecordReader(MolInputStream mis, 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:
      IllegalCharsetNameException - if illegal encoding is used
      UnsupportedCharsetException - if unsupported encoding is used
      SecurityException - if the module cannot be loaded because of a firewall problem
      MolFormatException
      See Also:
    • 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:
      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:
      SecurityException - if the module cannot be loaded because of a firewall problem
      MolExportException
      See Also:
    • createExportModule

      public MolExportModule createExportModule(String enc) throws MolExportException
      Creates the export module.
      Parameters:
      enc - the encoding
      Returns:
      the molecul export module or null if there is no exporter for this format
      Throws:
      SecurityException - if the module cannot be loaded because of a firewall problem
      MolExportException
      See Also:
    • 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
    • createRecognizer

      Deprecated, for removal: This API element is subject to removal in a future version.
      as of Marvin 2014.07.21.0 use createRecognizer() instead
      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:
      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