|
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
An extension of MessageElement for managing elements that are composed of character text. (as opposed to raw bytes).
Field Summary | |
protected long |
cachedGetCharLength
cached result of getCharLength() operation. |
protected SoftReference |
cachedGetChars
cached result of MessageElement.getBytes(boolean) operation. |
Fields inherited from class net.jxta.endpoint.MessageElement |
cachedGetByteLength, cachedGetBytes, cachedToString, name, properties, sig, type |
Constructor Summary | |
protected |
TextMessageElement(String name,
MimeMediaType type,
MessageElement sig)
Internal constructor for initializaing everything but the data. |
Method Summary | |
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. |
String |
getFileExtension()
Returns the file extension type used by this Document . This
value is usually chosen based upon the MIME Media Type.
We use the "unknown" extension and leave it to sub-classes to
extend this. If we had a mailcap facility we could do better
classification based on mimetype.
We use the "text" extension and leave it to sub-classes to extend
this. |
abstract Reader |
getReader()
Returns the sequence of characters which represents the content of this TextDocument . |
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.MessageElement |
clone, copyInputStreamToOutputStream, equals, getByteLength, getBytes, getElementName, getElementProperty, getMimeType, getSequentialName, getSignature, getUniqueName, hashCode, sendToStream, setElementProperty |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.jxta.document.Document |
getMimeType, getStream, sendToStream |
Field Detail |
protected transient long cachedGetCharLength
getCharLength()
operation.
protected transient SoftReference cachedGetChars
MessageElement.getBytes(boolean)
operation.
Constructor Detail |
protected TextMessageElement(String name, MimeMediaType type, MessageElement sig)
name
- Name of the Element. May be the empty string ("") if
the Element is not named.type
- Type of the Element. null is equivalent to specifying
the type "Application/Octet-stream"sig
- optional message digest/digital signature elemnent. If
no signature is to be specified, pass null.Method Detail |
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 enconding will be used.
synchronized for caching purposes.
synchronized for caching purposes.
toString
in interface TextDocument
toString
in class MessageElement
public String getFileExtension()
Document
. This
value is usually chosen based upon the MIME Media Type.
We use the "unknown" extension and leave it to sub-classes to
extend this. If we had a mailcap facility we could do better
classification based on mimetype.
We use the "text" extension and leave it to sub-classes to extend
this.
getFileExtension
in interface Document
getFileExtension
in class MessageElement
public long getCharLength()
public char[] getChars(boolean copy)
public abstract Reader getReader() throws IOException
TextDocument
.
getReader
in interface TextDocument
Reader
containing the characters of this
TextDocument
.
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 TextDocument
sendTo
- 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 |