net.kano.joscar.rvcmd.sendbl
Class SendBuddyListGroup

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

public class SendBuddyListGroup
extends java.lang.Object
implements LiveWritable

A data structure used in transferring (parts of) one's buddy list to another user.


Constructor Summary
SendBuddyListGroup(java.lang.String groupName, java.lang.String[] buddies)
          Creates a new Send Buddy List group object with the given group name and the given array of (non-null) screennames.
 
Method Summary
 java.lang.String[] getBuddies()
          Returns a list of the screennames of the buddies in this group.
 java.lang.String getGroupName()
          Returns the name of the represented group.
 int getTotalSize()
          Returns the total size, in bytes, of this object, as read from an incoming block of binary data.
static SendBuddyListGroup readBuddyListGroup(ByteBlock block)
          Reads a single "Send Buddy List group" structure from the given block of binary data.
static SendBuddyListGroup[] readBuddyListGroups(ByteBlock block)
          Generates an array of SendBuddyListGroups from the given block of binary data.
 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
 

Constructor Detail

SendBuddyListGroup

public SendBuddyListGroup(java.lang.String groupName,
                          java.lang.String[] buddies)
Creates a new Send Buddy List group object with the given group name and the given array of (non-null) screennames.

Parameters:
groupName - the name of the represented group
buddies - a list of the screennames of the buddies in this group
Method Detail

readBuddyListGroups

public static SendBuddyListGroup[] readBuddyListGroups(ByteBlock block)
Generates an array of SendBuddyListGroups from the given block of binary data. Note that this method will never return null; if no buddy list groups exist in the given block, an empty array will be returned. Note that the total number of bytes comprising the data represented in the returned array can be computed by simply summing the total size of each of the elements in the returned array.

Parameters:
block - a block of binary data containing zero or more "Send Buddy List group" structures
Returns:
a list of SendBuddyListGroups representing the groups in the given block

readBuddyListGroup

public static SendBuddyListGroup readBuddyListGroup(ByteBlock block)
Reads a single "Send Buddy List group" structure from the given block of binary data. Note that this method will return null if no complete group structure is present in the given block.

Parameters:
block - a block of binary data containing a "Send Buddy List group" block
Returns:
a SendBuddyListGroup read from the given block of data, or null if none could be read

getGroupName

public final java.lang.String getGroupName()
Returns the name of the represented group. This will be a string like "Buddies".

Returns:
the name of the represented group

getBuddies

public final java.lang.String[] getBuddies()
Returns a list of the screennames of the buddies in this group.

Returns:
a list of the screennames of the buddies in this group

getTotalSize

public final int getTotalSize()
Returns the total size, in bytes, of this object, as read from an incoming block of binary data. Note that this value will be -1 if this object was not read from a block of binary data but was instead created manually.

Returns:
the total size, in bytes, of this object, or -1 if this object was not read from an incoming block of data

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

toString

public java.lang.String toString()