net.kano.joscar.rvcmd
Class InvitationMessage

java.lang.Object
  extended byInvitationMessage
All Implemented Interfaces:
LiveWritable

public class InvitationMessage
extends java.lang.Object
implements LiveWritable

A data structure containing an invitation message string and a language in which that message was written. This structure is used in several rendezvous types, including inviting someone to a chat room and sending someone a file.


Constructor Summary
InvitationMessage(java.lang.String message)
          Creates a new invitation message with the given message body and with the JVM's current language.
InvitationMessage(java.lang.String message, java.util.Locale language)
          Creates a new invitation message object with the given message body and the language code of the given Locale.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.util.Locale getLanguage()
          Returns a Locale object whose language field represents the language used to write the invitation message body.
 java.lang.String getMessage()
          Returns the body of the invitation message contained in this invitation message block, or null if none is present.
 int hashCode()
           
static InvitationMessage readInvitationMessage(TlvChain chain)
          Returns an InvitationMessage with properties read from the given TLV chain.
 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, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvitationMessage

public InvitationMessage(java.lang.String message)
Creates a new invitation message with the given message body and with the JVM's current language. Using this constructor is equivalent to using new InvitationMessage(message, Locale.getDefault()).

Parameters:
message - the invitation message text, or null for none

InvitationMessage

public InvitationMessage(java.lang.String message,
                         java.util.Locale language)
Creates a new invitation message object with the given message body and the language code of the given Locale. Either field can be null, indicating that that field is not present in this invitation message block.

Parameters:
message - the invitation message body
language - a Locale object whose associated language represents the language in which the invitation message was written
Method Detail

readInvitationMessage

public static InvitationMessage readInvitationMessage(TlvChain chain)
Returns an InvitationMessage with properties read from the given TLV chain. Note that this method will never return null, even if no invitation message fields exist in the given TLV chain.

Parameters:
chain - a TLV chain containing invitation message TLV's
Returns:
an InvitationMessage read from the given TLV chain

getLanguage

public final java.util.Locale getLanguage()
Returns a Locale object whose language field represents the language used to write the invitation message body. Note that the returned value will be null if no such field was sent.

Returns:
a Locale whose language field represents the language in which the associated invitation message was written, or null if no language code was sent in this invitation message block

getMessage

public final java.lang.String getMessage()
Returns the body of the invitation message contained in this invitation message block, or null if none is present.

Returns:
the body of the invitation message in this block, or null if none is present

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: LiveWritable
Writes a representation of this object to the given stream.

Specified by:
write in interface LiveWritable
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

toString

public java.lang.String toString()