Project JXTA

net.jxta.document
Interface Document

All Known Subinterfaces:
StructuredDocument, StructuredTextDocument, TextDocument, XMLDocument
All Known Implementing Classes:
ByteArrayMessageElement, InputStreamMessageElement, MessageElement, StringMessageElement, TextDocumentMessageElement, TextMessageElement

public interface Document

A simple typed container for data. A Document is presented as a byte stream with an associated type. The data type is specified using a MIME Media Type (as defined by IETF RFC 2046 MIME : Media Types).

See Also:
MimeMediaType, StructuredDocument, StructuredDocumentFactory

Method Summary
 String getFileExtension()
          Returns the file extension type used by this Document.
 MimeMediaType getMimeType()
          Returns the MIME Media type of this Document per IETF RFC 2046 MIME : Media Types.
 InputStream getStream()
          Returns the stream of bytes which represents the content of this Document.
 void sendToStream(OutputStream stream)
          Send the contents of this Document to the specified stream.
 

Method Detail

getMimeType

MimeMediaType getMimeType()
Returns the MIME Media type of this Document per IETF RFC 2046 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.

getFileExtension

String getFileExtension()
Returns the file extension type used by this Document. This value is usually chosen based upon the MIME Media Type.

Returns:
A String containing an appropriate file extension for this Document.

getStream

InputStream getStream()
                      throws IOException
Returns the stream of bytes which represents the content of this Document.

Returns:
An InputStream containing the bytes of this Document.
Throws:
IOException - if an I/O error occurs.

sendToStream

void sendToStream(OutputStream stream)
                  throws IOException
Send the contents of this Document to the specified stream.

Parameters:
stream - The OutputStream to which the Document will be written.
Throws:
IOException - if an I/O error occurs.

JXTA J2SE