|
Project 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.endpoint.TextMessageElement
net.jxta.endpoint.StringMessageElement
public class StringMessageElement
A Message Element using character strings for the element data.
| Field Summary | |
|---|---|
protected String |
data
The data for this Message Element. |
| Fields inherited from class net.jxta.endpoint.TextMessageElement |
|---|
cachedGetCharLength, cachedGetChars |
| Fields inherited from class net.jxta.endpoint.MessageElement |
|---|
cachedGetByteLength, cachedGetBytes, cachedToString, name, properties, sig, type |
| Constructor Summary | |
|---|---|
StringMessageElement(String name,
String value,
MessageElement sig)
Create a new Message Element from the provided String. |
|
StringMessageElement(String name,
String value,
String encoding,
MessageElement sig)
Create a new Message Element from the provided String. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object target)
Elements are considered equal if they have the same name, type and signatures. |
byte[] |
getBytes(boolean copy)
Returns a byte array which contains the element data. |
long |
getCharLength()
Returns the size of the element data in characters synchronized for caching purposes. |
char[] |
getChars(boolean copy)
Returns a char array which contains the element data. |
Reader |
getReader()
Returns the sequence of characters which represents the content of this TextDocument. |
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.
This version probably has sub-optimal performance. |
void |
sendToWriter(Writer sendTo)
Send the contents of this TextDocument to the specified
Writer.
This version probably has sub-optimal performance. |
String |
toString()
Returns a String representation of the element data. The 'charset' parameter of the message element's mimetype, if
any, is used to determine encoding. If the charset specified is
unsupported then the default enconding will be used.
synchronized for caching purposes.
synchronized for caching purposes. |
| Methods inherited from class net.jxta.endpoint.TextMessageElement |
|---|
getFileExtension |
| Methods inherited from class net.jxta.endpoint.MessageElement |
|---|
clone, copyInputStreamToOutputStream, getByteLength, getElementName, getElementProperty, getMimeType, getSequentialName, getSignature, getUniqueName, setElementProperty |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.jxta.document.Document |
|---|
getMimeType |
| Field Detail |
|---|
protected String data
| Constructor Detail |
|---|
public StringMessageElement(String name,
String value,
MessageElement sig)
name - Name of the Element. May be the empty string ("") or null if
the Element is not named.value - A String containing the contents of this element.sig - Message digest/digital signature element. If no signature is
to be specified, pass null.
IllegalArgumentException - if value is
null.
public StringMessageElement(String name,
String value,
String encoding,
MessageElement sig)
throws UnsupportedEncodingException
name - Name of the MessageElement. May be the empty string ("") or
null if the MessageElement is not named.value - A String containing the contents of this element.encoding - Name of the character encoding to use. If
null then the system default charcter encoding will be
used. (Using the system default charcter encoding should be used with
extreme caution).sig - Message digest/digital signature element. If no signature is
to be specified, pass null.
IllegalArgumentException - if value is
null.
UnsupportedEncodingException - if the requested encoding is not
supported.| Method Detail |
|---|
public boolean equals(Object target)
equals in class MessageElementpublic int hashCode()
hashCode in class MessageElementpublic 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 enconding will be used.
synchronized for caching purposes.
synchronized for caching purposes.
toString in interface TextDocumenttoString in class TextMessageElementpublic 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 MessageElementcopy - 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 long getCharLength()
getCharLength in class TextMessageElementpublic char[] getChars(boolean copy)
getChars in class TextMessageElement
public InputStream getStream()
throws IOException
Document.
InputStream containing the bytes
of this Document.
IOException - if an I/O error occurs.
public Reader getReader()
throws IOException
TextDocument.
getReader in interface TextDocumentgetReader in class TextMessageElementIOException - when there is a problem getting a reader.
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 DocumentsendToStream in class MessageElementsendTo - The OutputStream to which the Document will
be written.
IOException - if an I/O error occurs.
public void sendToWriter(Writer sendTo)
throws IOException
TextDocument to the specified
Writer.
This version probably has sub-optimal performance. Sub-classes
should override this implementation if possible.
sendToWriter in interface TextDocumentsendToWriter in class TextMessageElementsendTo - The OutputStream to which the Document
will be written.
IOException - if an I/O error occurs.
|
JXTA J2SE | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||