|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.endpoint.MessageElement
net.jxta.impl.endpoint.JxtaMessageMessageElement
public class JxtaMessageMessageElement
A Message Element using a JXTA Message as the element data
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, sig, type |
Constructor Summary | |
---|---|
JxtaMessageMessageElement(String name,
MimeMediaType type,
Message msg,
MessageElement sig)
Create a new Message Element. |
Method Summary | |
---|---|
boolean |
equals(Object target)
Elements are considered equal if they have the same name, type and signatures. |
long |
getByteLength()
Returns the size of the element data in bytes. |
byte[] |
getBytes(boolean copy)
Returns a byte array which contains the element data. |
Message |
getMessage()
Returns a copy of the message which backs this element. |
InputStream |
getStream()
Returns the stream of bytes which represents the content of this Document . |
int |
hashCode()
|
void |
sendToStream(OutputStream sendTo)
Send the contents of this Document to the specified stream. |
String |
toString()
Returns a String representation of the element data. |
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 |
---|
protected final Message msg
protected transient WireFormatMessage serial
Constructor Detail |
---|
public JxtaMessageMessageElement(String name, MimeMediaType type, Message msg, MessageElement sig)
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 element or null if
no signature is desired.Method Detail |
---|
public boolean equals(Object target)
equals
in class MessageElement
public int hashCode()
hashCode
in class MessageElement
public String toString()
'charset'
parameter of the message element's mimetype, if
any, is used to determine encoding. If the charset specified is
unsupported then the default encoding will be used.
synchronized for caching purposes.
toString
in class MessageElement
public long getByteLength()
getByteLength
in class MessageElement
public byte[] getBytes(boolean copy)
copy
parameter allows you to request a
private, modifiable copy of the element data.
This implementation builds the byte array from the stream.
getBytes
in class MessageElement
copy
- If true then the result can be modified without damaging the state of this
MessageElement. If false, then the result may be a shared copy of the data and
should be considered read-only.
public InputStream getStream() throws IOException
Document
.
InputStream
containing the bytes
of this Document
.
IOException
- For errors while writing the Document
.public void sendToStream(OutputStream sendTo) throws IOException
Document
to the specified stream.
This version probably has sub-optimal performance. Sub-classes
should override this implementation.
sendToStream
in interface DocumentStreamIO
sendToStream
in class MessageElement
sendTo
- The OutputStream to which the Document
will
be written.
IOException
- For errors while writing the Document
.public Message getMessage()
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |