|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openscience.cdk.io.FormatFactory
@TestClass(value="org.openscience.cdk.io.FormatFactoryTest") public class FormatFactory
A factory for recognizing chemical file formats. Formats of GZiped files can be detected too. A typical example is:
StringReader stringReader = new StringReader("<molecule/>");
IChemFormat format = new FormatFactory().guessFormat(stringReader);
| Constructor Summary | |
|---|---|
FormatFactory()
Constructs a ReaderFactory which tries to detect the format in the first 65536 chars. |
|
FormatFactory(int headerLength)
Constructs a ReaderFactory which tries to detect the format in the first given number of chars. |
|
| Method Summary | |
|---|---|
List<IChemFormatMatcher> |
getFormats()
Returns the list of recognizable formats. |
IChemFormat |
guessFormat(InputStream input)
|
IChemFormat |
guessFormat(Reader input)
Creates a String of the Class name of the IChemObject reader
for this file format. |
void |
registerFormat(IChemFormatMatcher format)
Registers a format for detection. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FormatFactory()
public FormatFactory(int headerLength)
headerLength - length of the header in number of chars| Method Detail |
|---|
@TestMethod(value="testRegisterFormat") public void registerFormat(IChemFormatMatcher format)
@TestMethod(value="testGetFormats") public List<IChemFormatMatcher> getFormats()
List of IChemFormats.
@TestMethod(value="testGuessFormat_Reader")
public IChemFormat guessFormat(Reader input)
throws IOException
IChemObject reader
for this file format. The input is read line-by-line
until a line containing an identifying string is
found.
The ReaderFactory detects more formats than the CDK has Readers for.
This method is not able to detect the format of gziped files.
Use guessFormat(InputStream) instead for such files.
IChemFormat or null if the
file format is not recognized.
IOException - if an I/O error occurs
IllegalArgumentException - if the input is nullguessFormat(InputStream)
@TestMethod(value="testGuessFormat")
public IChemFormat guessFormat(InputStream input)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||