Project JXTA

net.jxta.impl.endpoint
Class JxtaMessageMessageElement

java.lang.Object
  extended by net.jxta.endpoint.MessageElement
      extended by net.jxta.impl.endpoint.JxtaMessageMessageElement
All Implemented Interfaces:
Document

public class JxtaMessageMessageElement
extends MessageElement

A Message Element using a JXTA Message as the element data

See Also:
Message, MessageElement

Field Summary
protected  Message msg
          The Message which is the data for this message element.
protected  WireFormatMessage serial
          A serialized form of the message.
 
Fields inherited from class net.jxta.endpoint.MessageElement
cachedGetByteLength, cachedGetBytes, cachedToString, name, properties, sig, type
 
Constructor Summary
JxtaMessageMessageElement(String name, MimeMediaType type, Message msg, MessageElement sig)
          Create a new Message Element.
 
Method Summary
 boolean equals(Object target)
          
 long getByteLength()
          
 byte[] getBytes(boolean copy)
          
 Message getMessage()
          Returns the message which backs this element.
 InputStream getStream()
          
 int hashCode()
          
 void sendToStream(OutputStream sendTo)
          
 String toString()
          
 
Methods inherited from class net.jxta.endpoint.MessageElement
clone, copyInputStreamToOutputStream, getElementName, getElementProperty, getFileExtension, getMimeType, getSequentialName, getSignature, getUniqueName, setElementProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

msg

protected Message msg
The Message which is the data for this message element.


serial

protected transient WireFormatMessage serial
A serialized form of the message.

Constructor Detail

JxtaMessageMessageElement

public JxtaMessageMessageElement(String name,
                                 MimeMediaType type,
                                 Message msg,
                                 MessageElement sig)
Create a new Message Element. The contents of the provided byte array are not copied during construction.

Parameters:
name - Name of the MessageElement. May be the empty string ("") if the MessageElement is not named.
type - Type of the MessageElement. null is the same as specifying the type "Application/Octet-stream".
msg - A message which will be used as the element content for this message.
sig - optional message digest/digital signature elemnent or null if no signature is desired.
Method Detail

equals

public boolean equals(Object target)

Overrides:
equals in class MessageElement

hashCode

public int hashCode()

Overrides:
hashCode in class MessageElement

toString

public String toString()

Overrides:
toString in class MessageElement

getByteLength

public long getByteLength()

Overrides:
getByteLength in class MessageElement

getBytes

public byte[] getBytes(boolean copy)

Overrides:
getBytes in class MessageElement

getStream

public InputStream getStream()
                      throws IOException

Throws:
IOException

sendToStream

public void sendToStream(OutputStream sendTo)
                  throws IOException

Specified by:
sendToStream in interface Document
Overrides:
sendToStream in class MessageElement
Throws:
IOException

getMessage

public Message getMessage()
Returns the message which backs this element.

Currently the message is modifiable, but should not be modified to obey the contract of MessageElement.

Returns:
Returns the message which backs this element.

JXTA J2SE