net.kano.joscar.snaccmd.conn
Class SnacFamilyInfo

java.lang.Object
  extended bySnacFamilyInfo
All Implemented Interfaces:
LiveWritable, Writable

public class SnacFamilyInfo
extends java.lang.Object
implements Writable

A data structure containing information about a specific SNAC family. SNAC families and the formats of their commands can change over time, so the client and server send "versions" of each family supported so that the server can incorporate new commands and new formats of existing commands without affecting clients which are not (yet) equipped to handle them.

All SNAC family information data provided in joscar simply mimics the behavior of AOL's Instant Messenger client for Windows. As a developer you are not expected (and certainly not required) to understand what the fields of this class are for, or what they mean; for the most part, I don't know what they signify either. Once again, they are just copied from WinAIM.


Constructor Summary
SnacFamilyInfo(int family, int version)
          Creates a new SNAC family version information block with the given SNAC family and family version.
SnacFamilyInfo(int family, int version, int toolID, int toolVersion)
          Creates a new SNAC family information block with the given properties.
 
Method Summary
 int getFamily()
          Returns the code of the SNAC family that this object describes.
 int getToolID()
          Returns the "tool ID" being used for this SNAC family's operations.
 int getToolVersion()
          Returns the version of the "tool" being used for this SNAC family's operations.
 int getVersion()
          Returns the version of the associated SNAC family supported.
 long getWritableLength()
          Returns the length of the data that was or will be written in a call to write.
protected static SnacFamilyInfo readSnacFamilyInfo(ByteBlock block)
          Returns a SNAC family information block read from the given block of 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

SnacFamilyInfo

public SnacFamilyInfo(int family,
                      int version)
Creates a new SNAC family version information block with the given SNAC family and family version. The tool ID and tool version number of this object will be -1. Using this constructor is equivalent to calling new SnacFamilyInfo(family, version, -1, -1).

Parameters:
family - the SNAC family
version - the version of the SNAC family supported

SnacFamilyInfo

public SnacFamilyInfo(int family,
                      int version,
                      int toolID,
                      int toolVersion)
Creates a new SNAC family information block with the given properties.

Parameters:
family - the SNAC family code
version - the version of the SNAC family supported
toolID - a number representing the "tool" used
toolVersion - the version of the "tool" being used
Method Detail

readSnacFamilyInfo

protected static SnacFamilyInfo readSnacFamilyInfo(ByteBlock block)
Returns a SNAC family information block read from the given block of data.

Parameters:
block - a block of data containing SNAC family information
Returns:
a SNAC family information block read from the given block of data

getFamily

public final int getFamily()
Returns the code of the SNAC family that this object describes.

Returns:
the SNAC family

getVersion

public final int getVersion()
Returns the version of the associated SNAC family supported.

Returns:
the SNAC family version

getToolID

public final int getToolID()
Returns the "tool ID" being used for this SNAC family's operations.

Returns:
the SNAC family tool ID

getToolVersion

public final int getToolVersion()
Returns the version of the "tool" being used for this SNAC family's operations.

Returns:
the SNAC family tool version

getWritableLength

public long getWritableLength()
Description copied from interface: Writable
Returns the length of the data that was or will be written in a call to write. The value returned by this method must not change after its first invocation.

Specified by:
getWritableLength in interface Writable
Returns:
the length of the data to be written by write

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: Writable
Writes a representation of this object to the given stream. The length of the data written by this function must match any value previously returned by getWritableLength.

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

toString

public java.lang.String toString()