net.kano.joscar.snaccmd
Class MiniUserInfo

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

public class MiniUserInfo
extends java.lang.Object
implements LiveWritable

A data structure containing a screen name and warning level.


Constructor Summary
  MiniUserInfo(java.lang.String sn, int warningLevel)
          Creates a new mini user info block with the given properties.
protected MiniUserInfo(java.lang.String sn, int warningLevel, int totalSize)
          Creates a new miniature user info block with the given properties.
 
Method Summary
 java.lang.String getScreenname()
          Returns this user info block's screenname.
 int getTotalSize()
          Returns the total size, in bytes, of this object, or -1 if this object was not read using readUserInfo.
 int getWarningLevel()
          Returns this user info block's warning level.
static MiniUserInfo readUserInfo(ByteBlock block)
          Returns a mini user info object generated from the given block of data, or null if no valid user info block exists in the given 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
 

Constructor Detail

MiniUserInfo

protected MiniUserInfo(java.lang.String sn,
                       int warningLevel,
                       int totalSize)
Creates a new miniature user info block with the given properties.

Parameters:
sn - the user's screenname
warningLevel - the user's warning level, or -1 if the warning level was not or is not to be sent
totalSize - the total size of this structure, as read from a block of binary data

MiniUserInfo

public MiniUserInfo(java.lang.String sn,
                    int warningLevel)
Creates a new mini user info block with the given properties.

Parameters:
sn - the user's screenname
warningLevel - the user's warning level
Method Detail

readUserInfo

public static MiniUserInfo readUserInfo(ByteBlock block)
Returns a mini user info object generated from the given block of data, or null if no valid user info block exists in the given block.

Parameters:
block - a block of bytes containing a mini user info block
Returns:
a mini user info object read from the given byte block

getScreenname

public final java.lang.String getScreenname()
Returns this user info block's screenname.

Returns:
the user's screenname

getWarningLevel

public final int getWarningLevel()
Returns this user info block's warning level.

Returns:
the user's warning level

getTotalSize

public final int getTotalSize()
Returns the total size, in bytes, of this object, or -1 if this object was not read using readUserInfo.

Returns:
the total size of this object, in bytes

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()