|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectChatMsg
Represents a single message sent or received in a chat room.
Field Summary | |
static java.lang.String |
CONTENTENCODING_DEFAULT
A default content encoding always used by the official AIM clients ("binary"). |
static java.lang.String |
CONTENTTYPE_DEFAULT
A default content type for "normal" (non-secure) chat rooms ("text/x-aolrtf"). |
static java.lang.String |
CONTENTTYPE_SECURE
A default content type for secure chat rooms ("application/pkcs7-mime"). |
Constructor Summary | |
ChatMsg(java.lang.String message)
Creates a new unencrypted chat message in the JVM's current language. |
|
ChatMsg(java.lang.String message,
java.util.Locale locale)
Creates a new unencrypted chat message in the given language. |
|
ChatMsg(java.lang.String contentType,
java.lang.String contentEncoding,
java.lang.String charset,
ByteBlock messageData,
java.util.Locale language)
Creates a new chat message with the given properties. |
Method Summary | |
java.lang.String |
getCharset()
Returns the charset in which the given message is encoded. |
java.lang.String |
getContentEncoding()
Returns the content encoding string sent with this message. |
java.lang.String |
getContentType()
Returns the content type string sent with this message. |
java.util.Locale |
getLanguage()
Returns a Locale object representing the language in which
this message was written, or null if no language value was
sent. |
java.lang.String |
getMessage()
Attempts to extract the actual message body from this chat message object. |
java.lang.String |
getMessageAsString()
Decodes the message data block stored in this message using the specified charset. |
ByteBlock |
getMessageData()
Returns the binary message data block contained in this message. |
static ChatMsg |
readChatMsg(ByteBlock msgBlock)
Reads a chat message from the given data block. |
java.lang.String |
toString()
|
void |
write(java.io.OutputStream out)
Writes a representation of this object to the given stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String CONTENTENCODING_DEFAULT
public static final java.lang.String CONTENTTYPE_DEFAULT
public static final java.lang.String CONTENTTYPE_SECURE
Constructor Detail |
public ChatMsg(java.lang.String message)
new ChatMessage(message, Locale.getDefault())
.
message
- the text of this chat messagepublic ChatMsg(java.lang.String message, java.util.Locale locale)
message
- the text of this chat messagelocale
- a locale object representing the language in which this
message is writtenpublic ChatMsg(java.lang.String contentType, java.lang.String contentEncoding, java.lang.String charset, ByteBlock messageData, java.util.Locale language)
contentType
- a content type string, like CONTENTTYPE_DEFAULT
contentEncoding
- a content encoding string, like CONTENTENCODING_DEFAULT
charset
- the charset in which the message is encodedmessageData
- the message data, possibly encryptedlanguage
- a Locale
object representing the language
in which the message was writtenMethod Detail |
public static ChatMsg readChatMsg(ByteBlock msgBlock)
msgBlock
- the data block containing chat message TLV's
public final ByteBlock getMessageData()
getMessage()
for details on extracting a message from
an unencrypted message block.
public final java.lang.String getContentType()
CONTENTTYPE_DEFAULT
for plaintext messages and
CONTENTTYPE_SECURE
for secure messages.
null
if none was sentpublic final java.lang.String getContentEncoding()
CONTENTENCODING_DEFAULT
.
null
if
none was sentpublic final java.lang.String getCharset()
null
if no charset was sent. For details on decoding
plaintext messages, see getMessage()
.
null
if no charset value was sentpublic final java.util.Locale getLanguage()
Locale
object representing the language in which
this message was written, or null
if no language value was
sent.
null
if no language value was sentpublic final java.lang.String getMessage()
null
if the
content type is non-null
and
is not equal to CONTENTTYPE_DEFAULT
because in such a case the
message is probably in a different format than plaintext (such as in
encrypted form).
null
if it suspects that the message is in a
different format. To force reading the message data as a plaintext
message (for example, if you know that the message data is in plaintext
format and not encrypted), use getMessageAsString()
.
null
if no plaintext message is presentpublic final java.lang.String getMessageAsString()
String
with the given
charset, most likely producing a string of "garbage."
OscarTools.getString(net.kano.joscar.ByteBlock, java.lang.String)
public void write(java.io.OutputStream out) throws java.io.IOException
LiveWritable
write
in interface LiveWritable
out
- the stream to which to write
java.io.IOException
- if an I/O error occurspublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |