Project JXTA

net.jxta.document
Interface Document

All Known Subinterfaces:
StructuredDocument, StructuredTextDocument, TextDocument

public interface Document

JXTA documents are simple containers for data. JXTA makes no interpretation of the data contained in a Document. Each Document is typed using a MIME Media Type (as defined by {@see MIME : Media Types}) Note : Document is intended to be somewhat analagous to HTTP streams we don't provide for compression, encoding, etc. though and leave it all up to the MIME media type and whatever parameters it may specify. Its not clear if we should break this stuff up and include such attributes or leave it as is.

Since:
JXTA 1.0
See Also:
Document, StructuredDocument, StructuredTextDocument

Method Summary
 MimeMediaType getMimeType()
          Returns the MIME Media type of this Document per {@see MIME : Media Types} Jxta does not currently support the 'Multipart' or 'Message' media types.
 java.io.InputStream getStream()
          Returns a stream of bytes which represent the content of this Document.
 void sendToStream(java.io.OutputStream stream)
          Rather than returning an InputStream like getStream(), send the document to the specified stream.
 

Method Detail

getMimeType

public MimeMediaType getMimeType()
Returns the MIME Media type of this Document per {@see MIME : Media Types} Jxta does not currently support the 'Multipart' or 'Message' media types.
Returns:
A MimeMediaType object containing the MIME Media Type for this Document.
Since:
JXTA 1.0

getStream

public java.io.InputStream getStream()
                              throws java.io.IOException
Returns a stream of bytes which represent the content of this Document.
Returns:
An {@see java.io.InputStream InputStream} containing the bytes of this Document.
Throws:
java.io.IOException - if an I/O error occurs.
Since:
JXTA 1.0

sendToStream

public void sendToStream(java.io.OutputStream stream)
                  throws java.io.IOException
Rather than returning an InputStream like getStream(), send the document to the specified stream.
Parameters:
stream - The OutputStream to which the document will be written.
Throws:
java.io.IOException - if an I/O error occurs.
Since:
JXTA 1.0

Project JXTA