JXTA

net.jxta.impl.endpoint
Class WireFormatMessageBinary.binaryMessageProxy

java.lang.Object
  extended by net.jxta.impl.endpoint.WireFormatMessageBinary.binaryMessageProxy
All Implemented Interfaces:
Document, DocumentByteBufferIO, DocumentStreamIO, WireFormatMessage
Enclosing class:
WireFormatMessageBinary

static class WireFormatMessageBinary.binaryMessageProxy
extends Object
implements WireFormatMessage

Internal representation for a binary format wire message. Implemented as an inner class to allow content encodings to be easily mapped on top of the streams this class produces.


Field Summary
(package private)  List<WireFormatMessageBinary.binaryElementProxy> elements
           
(package private)  byte[] header
           
(package private)  Message message
           
(package private)  Map<String,Integer> namespaceIDs
           
(package private)  List<String> namespaces
           
(package private)  MimeMediaType type
           
 
Constructor Summary
WireFormatMessageBinary.binaryMessageProxy(Message msg, MimeMediaType type)
           
 
Method Summary
 ByteBuffer[] getByteBuffers()
          Returns the Document as a sequence of ByteBuffers
 long getByteLength()
          Returns the size of the serialized and encoded form of the message in bytes.
 MimeMediaType getContentEncoding()
          Returns the encoding used for this content.
 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 sendTo)
          Send the contents of this Document to the specified stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

final Message message

type

final MimeMediaType type

elements

final List<WireFormatMessageBinary.binaryElementProxy> elements

namespaceIDs

final Map<String,Integer> namespaceIDs

namespaces

final List<String> namespaces

header

byte[] header
Constructor Detail

WireFormatMessageBinary.binaryMessageProxy

WireFormatMessageBinary.binaryMessageProxy(Message msg,
                                           MimeMediaType type)
                                     throws IOException
Throws:
IOException
Method Detail

getFileExtension

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

Specified by:
getFileExtension in interface Document
Returns:
An appropriate file extension 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:
The MIME Media Type for this Document.

getByteBuffers

public ByteBuffer[] getByteBuffers()
Returns the Document as a sequence of ByteBuffers

Specified by:
getByteBuffers in interface DocumentByteBufferIO

getStream

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

Specified by:
getStream in interface DocumentStreamIO
Returns:
An InputStream containing the bytes of this Document.
Throws:
IOException - For errors while writing the Document.

sendToStream

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

Specified by:
sendToStream in interface DocumentStreamIO
Parameters:
sendTo - The OutputStream to which the Document will be written.
Throws:
IOException - For errors while writing the Document.

getByteLength

public long getByteLength()
Returns the size of the serialized and encoded form of the message in bytes.

Specified by:
getByteLength in interface WireFormatMessage
Returns:
The size of the serialized and encoded message in bytes.

getContentEncoding

public MimeMediaType getContentEncoding()
Returns the encoding used for this content. May be null for unencoded (raw) content.

Specified by:
getContentEncoding in interface WireFormatMessage
Returns:
The encoding used for this message.

JXSE