| 1 | {{{ |
| 2 | #!java |
| 3 | /** |
| 4 | * A general interface for data objects that have some Stream-based file content. These objects may |
| 5 | * be files on filesystems, web files received through http or emails stored in an email server. |
| 6 | * All methods of DataObject are inherited. Additional is the <b>binary content</b> and the |
| 7 | * handling of the stream. For the extraction, both the InputStream |
| 8 | * returned by getContent() and |
| 9 | * the RDF metadata returned by getMetadata() are important. |
| 10 | */ |
| 11 | public interface DataObjectFile extends DataObject { |
| 12 | |
| 13 | /** |
| 14 | * Returns the byte size of the represented resource. This has been defined at |
| 15 | * this global level due to the importance of this attribute for performance reasons. |
| 16 | * @return the size of the binary resource in bytes, or a negative value when the |
| 17 | * size is unknown or does not make sense for this particular DataObject implementation. |
| 18 | */ |
| 19 | public long getSize(); |
| 20 | |
| 21 | /** |
| 22 | * Gets an InputStream containing the content represented by the DataObject. |
| 23 | * The returned InputStream is required to support marking (markSupported() |
| 24 | * returns true). Calling this method multiple times may references to |
| 25 | * one-and-the-same InputStream instance. Care should therefore be taken to mark |
| 26 | * and reset the stream when the stream's content is to be read again later. |
| 27 | * |
| 28 | * @return An InputStream from which the content of the data object can be read. |
| 29 | * @throws IOException If an I/O error occurred. |
| 30 | */ |
| 31 | public InputStream getContent() throws IOException; |
| 32 | |
| 33 | /** |
| 34 | * Instructs the DataObject that its content stream will most likely be used multiple |
| 35 | * times in its entirety, making the mark-and-reset procedure difficult to work, |
| 36 | * and that it better should cache the entire contents. |
| 37 | * @throws IOException when an IOException occured during caching of the content. |
| 38 | */ |
| 39 | ´ public void cacheContent() throws IOException; |
| 40 | |
| 41 | /** |
| 42 | * what is the mime-type of the content, if there is content? |
| 43 | * This is set by the DataAccessor |
| 44 | * @return null or a mimetype identifier like "text/plain" |
| 45 | */ |
| 46 | public String getContentMimeType(); |
| 47 | |
| 48 | /** |
| 49 | * what is the character-encoding (using ansi identifiers like "UTF-8" |
| 50 | * or "ISO-8859-1") of the content, if there is content. Will |
| 51 | * return null if not known or if content is null. |
| 52 | * This is set by the DataAccessor |
| 53 | * @return null or a encoding identifier like "UTF-8" |
| 54 | */ |
| 55 | public String getContentEncoding(); |
| 56 | } |
| 57 | }}} |