@PublicAPI public class DocumentAnnotator extends java.lang.Object implements chemaxon.marvin.io.formats.MoleculeImporterIface, java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
DocumentAnnotator.DocumentType |
static interface |
DocumentAnnotator.Listener |
static class |
DocumentAnnotator.ProgressInfo |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MOL_UID_PROPERTY |
Constructor and Description |
---|
DocumentAnnotator(java.io.File sourceDocument)
Constructs a DocumentAnnotator to annotate the given document file.
|
DocumentAnnotator(java.io.InputStream sourceDocument)
Constructs a DocumentAnnotator to annotate the given document.
|
DocumentAnnotator(java.io.InputStream sourceDocument,
DocumentAnnotator.DocumentType documentType)
Constructs a DocumentAnnotator to annotate the given document.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static DocumentAnnotator |
fromPlainText(java.io.Reader source)
Constructs a DocumentAnnotator to annotate the given text.
|
boolean |
isAnnotationSupported() |
void |
process()
Process the complete input at once, generating the annotated document.
|
Molecule |
read()
Find the next structure in the source document and return it, or null when the end of the document has been reached.
|
boolean |
setAnnotatedOutput(java.io.File destination)
Set the destination file where an annotated version of the source document
should be written.
|
boolean |
setAnnotatedOutput(java.io.OutputStream destination)
Set the destination output stream where an annotated version of the source document
should be written.
|
java.io.File |
setAnnotatedOutputDirectory(java.io.File annotateDirectory)
Set the directory where the annotated document and associated resources will be placed.
|
java.io.File |
setAnnotatedOutputDirectory(java.io.File annotateDirectory,
boolean keepOriginalExtension)
Set the directory where the annotated document and associated resources will be placed.
|
void |
setCustomHtmlToXmlConverter(chemaxon.naming.document.annotate.XmlToHtmlConverter customConverter)
Provide a custom converter from XML to HTML, to be used instead of the default one.
|
void |
setD2SOptions(chemaxon.naming.document.DocumentToStructureOptions options) |
void |
setD2SOptions(java.lang.String options)
Deprecated.
use setD2SOptions(D2S.Options) instead
An option String can be parsed to a D2S.Options object using D2SOptionParser.parseOptions().
|
void |
setMolconvert(java.io.File molconvert) |
void |
setOptions(DocumentAnnotatorOptions options) |
void |
setResourceDirectory(java.io.File resourceDirectory)
Set the directory where resources will be stored.
|
void |
usePopups(boolean addPopups) |
public static final java.lang.String MOL_UID_PROPERTY
public DocumentAnnotator(java.io.File sourceDocument) throws java.io.FileNotFoundException
sourceDocument
- the document to annotatejava.io.FileNotFoundException
- if the document does not existpublic DocumentAnnotator(java.io.InputStream sourceDocument) throws java.io.IOException
new DocumentAnnotator(sourceDocument, DocumentAnnotator.DocumentType.TXT)
sourceDocument
- the document to annotatejava.io.IOException
public DocumentAnnotator(java.io.InputStream sourceDocument, DocumentAnnotator.DocumentType documentType)
sourceDocument
- the document to annotatedocumentType
- the type of the source documentpublic static DocumentAnnotator fromPlainText(java.io.Reader source)
source
- a Reader representing the source documentpublic void setOptions(DocumentAnnotatorOptions options)
public boolean isAnnotationSupported()
public boolean setAnnotatedOutput(java.io.File destination) throws java.io.IOException
java.io.IOException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reasonisAnnotationSupported()
public boolean setAnnotatedOutput(java.io.OutputStream destination)
isAnnotationSupported()
public java.io.File setAnnotatedOutputDirectory(java.io.File annotateDirectory) throws java.io.IOException
annotateDirectory
- the destination directoryjava.io.IOException
- if the directory cannot be used to store files.public java.io.File setAnnotatedOutputDirectory(java.io.File annotateDirectory, boolean keepOriginalExtension) throws java.io.IOException
annotateDirectory
- the destination directoryjava.io.IOException
- if the directory cannot be used to store files.public void setResourceDirectory(java.io.File resourceDirectory) throws java.io.IOException
java.io.IOException
- if the directory cannot be used to store files.public void setD2SOptions(chemaxon.naming.document.DocumentToStructureOptions options)
@Deprecated public void setD2SOptions(java.lang.String options)
public void usePopups(boolean addPopups)
addPopups
- whether a popup should be generated for each hitpublic void setMolconvert(java.io.File molconvert)
public void setCustomHtmlToXmlConverter(chemaxon.naming.document.annotate.XmlToHtmlConverter customConverter)
public Molecule read() throws java.io.IOException
read
in interface chemaxon.marvin.io.formats.MoleculeImporterIface
java.io.IOException
public void close() throws java.io.IOException
close
in interface chemaxon.marvin.io.formats.MoleculeImporterIface
close
in interface java.lang.AutoCloseable
java.io.IOException
public void process() throws java.io.IOException
java.io.IOException
Used the read() method instead if you want to also get access to the structures found in the document.