|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.formats.MFileFormatUtil
public class MFileFormatUtil
File format related utility functions.
| Field Summary | |
|---|---|
static int |
MOLMOVIE
Read multi-molecule files as movies. |
static int |
MULTISET
The multi-molecule file really contains multiple atom sets of one molecule. |
static int |
NOMOLMOVIE
Do not read multi-molecule XYZ files as movies. |
| Constructor Summary | |
|---|---|
MFileFormatUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
canBeAbbrevgroup(java.lang.String line)
Deprecated. as of Marvin 5.0, AbbrevGroupRecognizer.testLine(String)
must be used instead |
static boolean |
canBeJTF(java.lang.String line)
Deprecated. as of Marvin 5.0, JTFRecognizer.canBeJTFHeader(String)
must be used instead |
static boolean |
canBePDBRecord(java.lang.String recName)
Deprecated. as of Marvin 5.0, PDBRecognizer.testRecord(String)
must be used instead |
static java.lang.String[] |
convertToSmilingFormat(Molecule m)
Tries to convert a molecule to a SMILES related format. |
static java.lang.String[] |
convertToSmilingFormat(MProp p)
Try to convert a property to text with a SMILES related format argument. |
static MolExportModule |
createExportModule(java.lang.String fmt)
Creates an export module for the specified format. |
static MRecordReader |
createRecordReader(java.io.InputStream is,
java.lang.String opts)
Creates a record reader for an input stream. |
static MRecordReader |
createRecordReader(java.io.InputStream is,
java.lang.String opts,
java.lang.String enc,
java.lang.String path)
Creates a record reader for an input stream. |
static MFileFormat[] |
findFormats(java.lang.String fmt,
long flags,
long mask)
Gets a list of formats. |
static java.lang.String[] |
getEncodingFromOptions(java.lang.String fmtopts)
Gets the encoding that was explicitly given as an import option. |
static java.lang.String |
getFileExtensionLC(java.io.File f)
Gets the file extension in lower case. |
static java.lang.String |
getFileExtensionLC(java.lang.String fname)
Gets the file extension in lower case. |
static MFileFormat |
getFormat(java.lang.String fmt)
Gets the file format descriptor for the specified codename. |
static java.lang.String[] |
getJTFFields(java.lang.String line)
Gets fields delimited with {space} {tab} {;} {:} or {,}. |
static java.lang.String |
getKnownExtension(java.lang.String fname)
Returns the file extension if it is a known extension. |
static java.lang.String[] |
getMolfileExtensions()
Gets the array of known molecule file extensions. |
static java.lang.String[] |
getMolfileFormats()
Gets the array of known molecule file formats. |
static java.lang.String |
getMostLikelyMolFormat(java.lang.String fname)
Gets the most likey molecule file format from the file name extension. |
static java.lang.String |
getUnguessableFormat(java.lang.String fname)
Gets the file format from the file name extension for formats that are not guessable from the file content. |
static java.lang.String |
guessPeptideFormat(java.lang.String header)
Deprecated. as of Marvin 5.0, PeptideRecognizer.guessPeptideFormat(String)
must be used instead |
static boolean |
isCubeLine(java.lang.String line,
int count)
Deprecated. as of Marvin 5.0, CubeRecognizer.isCubeLine(String, int)
must be used instead |
static boolean |
isOutputCleanable(java.lang.String fmt)
Tests whether the specified output format is cleanable. |
static boolean |
isSubFormatOf(java.lang.String f,
java.lang.String other)
Tests whether a format is a sub-format of another format. |
static boolean |
isURLOrFileName(java.lang.String s)
Tests whether the specified string is an URL (absolute or relative) or file name. |
static int |
preprocessFormatAndOptions(java.lang.String[] fmtopts)
Parses options like "MULTISET", "MOLMOVIE" or "NOMOLMOVIE". |
static java.lang.String |
recognizeOneLineFormat(java.lang.String s)
Recognize a one-line string as CxSMILES, CxSMARTS, AbbrevGroup, Peptide or IUPAC name. |
static void |
registerFormat(MFileFormat mff)
Registers a user defined file format. |
static java.lang.String[] |
splitFileAndOptions(java.lang.String arg)
Parses "file{options}" strings used in molecule file import. |
static java.lang.String[] |
splitFormatAndOptions(java.lang.String opts)
Parses "format:options" strings used in molecule file import and export. |
static void |
testEncoding(java.lang.String enc)
Tests whether the given charset name is supported by this JVM |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MULTISET
public static final int MOLMOVIE
public static final int NOMOLMOVIE
| Constructor Detail |
|---|
public MFileFormatUtil()
| Method Detail |
|---|
public static boolean isURLOrFileName(java.lang.String s)
s - the string
public static boolean isSubFormatOf(java.lang.String f,
java.lang.String other)
f - the format codenameother - the other format
public static java.lang.String recognizeOneLineFormat(java.lang.String s)
s - the input string
@Deprecated public static boolean canBeAbbrevgroup(java.lang.String line)
AbbrevGroupRecognizer.testLine(String)
must be used instead
@Deprecated public static boolean canBeJTF(java.lang.String line)
JTFRecognizer.canBeJTFHeader(String)
must be used instead
@Deprecated public static boolean canBePDBRecord(java.lang.String recName)
PDBRecognizer.testRecord(String)
must be used instead
@Deprecated
public static boolean isCubeLine(java.lang.String line,
int count)
CubeRecognizer.isCubeLine(String, int)
must be used instead
public static java.lang.String[] getJTFFields(java.lang.String line)
public static java.lang.String[] splitFileAndOptions(java.lang.String arg)
arg - string containing the filename and the options
(if there are)
public static java.lang.String[] splitFormatAndOptions(java.lang.String opts)
splitFormatAndOptions("xyz:f1.4") returns {"xyz", "f1.4"}
splitFormatAndOptions("f1.4") returns {null, "f1.4"}
splitFormatAndOptions("xyz:") returns {"xyz", ""}
splitFormatAndOptions("gzip:xyz:f1.4") returns {"gzip", "xyz:f1.4"}
The semicolon can be omitted in case if Marvin's built-in input formats.
Example:
splitFormatAndOptions("xyz") returns { "xyz", ""}
opts - string containing the format and the options
public static int preprocessFormatAndOptions(java.lang.String[] fmtopts)
String[] fmtopts = splitFormatAndOptions("gzip:xyz:MULTISET,f1.4");
// fmtopts == {"gzip", "xyz:MULTISET,f.14"}
int result = preprocessFormatAndOptions(fmtopts);
// fmtopts == {"gzip", "xyz:f.14"}, results == MULTISET
fmtopts - two-element array containing the format and the options
splitFormatAndOptions(java.lang.String),
MULTISET,
MOLMOVIE,
NOMOLMOVIEpublic static java.lang.String[] getEncodingFromOptions(java.lang.String fmtopts)
fmtopts - the input format and options
java.nio.charset.IllegalCharsetNameException - if the encoding is illegal
java.nio.charset.UnsupportedCharsetException - if the encoding is unsupported
public static void testEncoding(java.lang.String enc)
throws java.lang.IllegalArgumentException
enc - the name of the charset
java.lang.IllegalArgumentExceptionpublic static java.lang.String getUnguessableFormat(java.lang.String fname)
fname - the filename
public static java.lang.String getFileExtensionLC(java.io.File f)
f - the file
public static java.lang.String getFileExtensionLC(java.lang.String fname)
fname - the filename
public static java.lang.String getMostLikelyMolFormat(java.lang.String fname)
fname - the filename
public static java.lang.String getKnownExtension(java.lang.String fname)
fname - the filename
public static java.lang.String[] getMolfileExtensions()
public static java.lang.String[] getMolfileFormats()
public static boolean isOutputCleanable(java.lang.String fmt)
throws java.lang.SecurityException
fmt - the format string
java.lang.SecurityException@Deprecated public static java.lang.String guessPeptideFormat(java.lang.String header)
PeptideRecognizer.guessPeptideFormat(String)
must be used instead
public static void registerFormat(MFileFormat mff)
MFileFormat.F_USER_DEFINED flag is automatically set.
mff - the file formatpublic static MFileFormat getFormat(java.lang.String fmt)
fmt - the format codename
null if not found
public static MFileFormat[] findFormats(java.lang.String fmt,
long flags,
long mask)
fmt - the format name or null if not importantflags - select formats of which the specified flags are setmask - only bits specified here are taken into account
public static MRecordReader createRecordReader(java.io.InputStream is,
java.lang.String opts)
throws MolFormatException,
java.io.IOException
is - the input streamopts - input options or null
null if the format was
not recognized
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
java.io.IOExceptionMFileFormat.createRecordReader(MolInputStream, String)
public static MRecordReader createRecordReader(java.io.InputStream is,
java.lang.String opts,
java.lang.String enc,
java.lang.String path)
throws MolFormatException,
java.io.IOException
is - the input streamopts - input options or nullenc - the input encoding or nullpath - the file path (it can also be an URL) or null
null if the format was
not recognized
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
java.io.IOExceptionMFileFormat.createRecordReader(MolInputStream, String)
public static MolExportModule createExportModule(java.lang.String fmt)
throws MolExportException
fmt - the format name
java.lang.SecurityException - if the module cannot be loaded because of
a firewall problem
MolExportExceptionMFileFormat.createExportModule()
public static java.lang.String[] convertToSmilingFormat(Molecule m)
throws MolExportException
MolExportException - if conversion was not successful
public static java.lang.String[] convertToSmilingFormat(MProp p)
throws MolExportException
MolExportException - if conversion was not successful
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||