The format of Documents. Subclasses of DocumentFormat know about particular MIME types and how to unpack the information in any markup or formatting they contain into GATE annotations. Each MIME type has its own subclass of DocumentFormat, e.g. XmlDocumentFormat, RtfDocumentFormat, MpegDocumentForma
| 50 | * format class for a particular document. |
| 51 | */ |
| 52 | public abstract class DocumentFormat |
| 53 | extends AbstractLanguageResource { |
| 54 | |
| 55 | private static final long serialVersionUID = 4147880563349143923L; |
| 56 | |
| 57 | /** The MIME type of this format. */ |
| 58 | private MimeType mimeType = null; |
| 59 | |
| 60 | /** Map of MimeTypeString to ClassHandler class. This is used to find the |
| 61 | * language resource that deals with the specific Document format |
| 62 | */ |
| 63 | protected static final Map<String, DocumentFormat> |
| 64 | mimeString2ClassHandlerMap = new HashMap<String, DocumentFormat>(); |
| 65 | /** Map of MimeType to DocumentFormat Class. This is used to find the |
| 66 | * DocumentFormat subclass that deals with a particular MIME type. |
| 67 | */ |
| 68 | protected static final Map<String, MimeType> |
| 69 | mimeString2mimeTypeMap = new HashMap<String, MimeType>(); |
| 70 | |
| 71 | /** Map of Set of file suffixes to MimeType. This is used to figure |
| 72 | * out what MIME type a document is from its file name. |
| 73 | */ |
| 74 | protected static final Map<String, MimeType> |
| 75 | suffixes2mimeTypeMap = new HashMap<String, MimeType>(); |
| 76 | |
| 77 | /** Map of Set of magic numbers to MimeType. This is used to guess the |
| 78 | * MIME type of a document, when we don't have any other clues. |
| 79 | */ |
| 80 | protected static final Map<String, MimeType> |
| 81 | magic2mimeTypeMap = new HashMap<String, MimeType>(); |
| 82 | |
| 83 | /** Map of markup elements to annotation types. If it is null, the |
| 84 | * unpackMarkup() method will convert all markup, using the element names |
| 85 | * for annotation types. If it is non-null, only those elements specified |
| 86 | * here will be converted. |
| 87 | */ |
| 88 | protected Map<String,String> markupElementsMap = null; |
| 89 | |
| 90 | /** This map is used inside uppackMarkup() method... |
| 91 | * When an element from the map is encounted, The corresponding string |
| 92 | * element is added to the document content |
| 93 | */ |
| 94 | protected Map<String,String> element2StringMap = null; |
| 95 | |
| 96 | /** The features of this resource */ |
| 97 | private FeatureMap features = null; |
| 98 | |
| 99 | /** Default construction */ |
| 100 | public DocumentFormat() {} |
| 101 | |
| 102 | /** listeners for status report */ |
| 103 | private transient Vector<StatusListener> statusListeners; |
| 104 | |
| 105 | /** Flag for enable/disable collecting of repositioning information */ |
| 106 | private Boolean shouldCollectRepositioning = Boolean.FALSE; |
| 107 | |
| 108 | /** If the document format could collect repositioning information |
| 109 | * during the unpack phase this method will return <B>true</B>. |
nothing calls this directly
no outgoing calls
no test coverage detected