|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileDataObject
A general interface for DataObjects that have File-like semantics. Examples are files or web pages.
Method Summary | |
---|---|
File |
downloadContent()
Downloads the entire content of the stream to a temporary file (created with File.createTempFile(String, String) ). |
InputStream |
getContent()
Gets an InputStream containing the content represented by the DataObject. |
File |
getFile()
Returns an instance of java.io.File representing the content of this FileDataObject. |
void |
setContent(InputStream stream)
Sets the InputStream containing the content represented by the DataObject. |
void |
setFile(File file)
Sets the file containing the content represented by this FileDataObject. |
Methods inherited from interface org.semanticdesktop.aperture.accessor.DataObject |
---|
dispose, getDataSource, getID, getMetadata |
Method Detail |
---|
InputStream getContent() throws IOException
The returned InputStream is required to support marking (markSupported() must return true). Calling this method multiple times may return references to one-and-the-same InputStream instance. Care should therefore be taken to mark and reset the stream when the stream's content is to be read again later.
The returned InputStream is null in cases where the physical resource could not be accessed, e.g. in case of missing file read permissions.
IOException
- If an I/O error occurred.void setContent(InputStream stream)
stream
- The InputStream containing the resource's content.File getFile()
File
instance (e.g. to pass it to a FileExtractor) and this method returns null,
you can use the downloadContent()
method. If the downloadContent()
method doesn't meet
your needs, you can use the stream returned by getContent()
and implement the download process
by yourself. Note that the IOUtil.writeStream(InputStream, File)
method may be useful for this.
File downloadContent() throws IOException
File.createTempFile(String, String)
). It is the responsibility of the user to delete the file
if it is no longer needed. getFile()
method
returns a non-null value.
File
instance for the temporary file where the content of the stream has been
downloaded.
IOException
- If the content stream is not at the beginning of the file, or if an I/O error
occured during the download process.void setFile(File file)
file
- the file with the content of this FileDataObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |