Project JXTA

net.jxta.impl.document
Class BinaryDocument

java.lang.Object
  extended by net.jxta.impl.document.BinaryDocument
All Implemented Interfaces:
Document

public class BinaryDocument
extends Object
implements Document

This class is an implementation of the Document interface. It is perhaps the simplest implementation of the Document interface possible.


Constructor Summary
BinaryDocument(byte[] someBytes)
          Creates new BinaryDocument
 
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 a stream of bytes which represent the content of this Document.
static MimeMediaType[] getSupportedMimeTypes()
          Returns the MIME Media types supported by this this Document per IETF RFC 2046 MIME : Media Types.
 void sendToStream(OutputStream stream)
          Returns a stream of bytes which represent the content of this Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryDocument

public BinaryDocument(byte[] someBytes)
Creates new BinaryDocument

Parameters:
someBytes - Contains a byte array which will serve as our data.
Method Detail

getSupportedMimeTypes

public static MimeMediaType[] getSupportedMimeTypes()
Returns the MIME Media types supported by this this Document per IETF RFC 2046 MIME : Media Types. Jxta does not currently support the 'Multipart' or 'Message' media types.

Returns:
An array of MimeMediaType objects containing the MIME Media Type for this Document.

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.

Specified by:
getMimeType in interface Document
Returns:
A MimeMediaType object containing the MIME Media Type for this Document.

getFileExtension

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

Specified by:
getFileExtension in interface Document
Returns:
a string containing an appropriate file extension

getStream

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

Specified by:
getStream in interface Document
Returns:
An InputStream containting the bytes of this Document.
Throws:
IOException

sendToStream

public void sendToStream(OutputStream stream)
                  throws IOException
Returns a stream of bytes which represent the content of this Document.

Specified by:
sendToStream in interface Document
Throws:
IOException

JXTA J2SE