net.kano.joscar.flapcmd
Class SnacPacket

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

public final class SnacPacket
extends java.lang.Object
implements LiveWritable

Represents a single "packet" or SNAC command sent over a FLAP connection.


Constructor Summary
SnacPacket(int family, int command, long reqid, short flag1, short flag2, ByteBlock data)
          Creates a SNAC packet object with the given properties.
 
Method Summary
 int getCommand()
          Returns this packet's SNAC command code ("subtype").
 ByteBlock getData()
          Returns this packet's SNAC data block, or null if this packet was not read from an incoming stream.
 int getFamily()
          Returns this packet's SNAC family code.
 short getFlag1()
          Returns this packet's first SNAC flag byte.
 short getFlag2()
          Returns this packet's second SNAC flag byte.
 long getReqid()
          Returns this packet's SNAC request ID.
 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

SnacPacket

public SnacPacket(int family,
                  int command,
                  long reqid,
                  short flag1,
                  short flag2,
                  ByteBlock data)
Creates a SNAC packet object with the given properties.

Parameters:
family - the packet's SNAC family code
command - the packet's SNAC family command subtype
reqid - the packet's request ID
flag1 - the packet's first SNAC flag byte
flag2 - the packet's second SNAC flag byte
data - the SNAC data block
Method Detail

getFamily

public final int getFamily()
Returns this packet's SNAC family code.

Returns:
this packet's SNAC family

getCommand

public final int getCommand()
Returns this packet's SNAC command code ("subtype").

Returns:
this packet's SNAC command subtype

getReqid

public final long getReqid()
Returns this packet's SNAC request ID.

Returns:
this packet's SNAC request ID

getFlag1

public final short getFlag1()
Returns this packet's first SNAC flag byte.

Returns:
this packet's first SNAC flag byte

getFlag2

public final short getFlag2()
Returns this packet's second SNAC flag byte.

Returns:
this packet's second SNAC flag byte

getData

public final ByteBlock getData()
Returns this packet's SNAC data block, or null if this packet was not read from an incoming stream.

Returns:
this packet's SNAC data block, if read from an incoming stream

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