Project JXTA

net.jxta.document
Interface Document

All Known Subinterfaces:
StructuredDocument, StructuredTextDocument, TextDocument
All Known Implementing Classes:
NewMessageElement

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 IETF RFC 2046 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
Version:
$Revision: 1.13 $
See Also:
Document, MimeMediaType, StructuredDocument, StructuredTextDocument

Method Summary
 java.lang.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

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 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.
Since:
JXTA 1.0

getFileExtension

public java.lang.String getFileExtension()
Returns the file extension type used by this Document. This value is chosen based upon the MIME Media Type for this Document.
Returns:
a string containing an appropriate file extension
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 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