net.kano.joscar.flapcmd
Class SnacFlapCmd

java.lang.Object
  extended byFlapCommand
      extended bySnacFlapCmd

public class SnacFlapCmd
extends FlapCommand

A FLAP command that contains a SNAC packet as its FLAP data. This is how the majority of communication between a normal OSCAR client and server takes place. A SNAC packet is not really a "packet" but more appropriately a data structure inside of a channel-2 FLAP packet. Unfortunately for you, however, I've chosen to continue using the name "SNAC packet."


Field Summary
static int CHANNEL_SNAC
          The channel on which SNAC commands reside.
 
Constructor Summary
SnacFlapCmd(FlapPacket flapPacket)
          Generates a SnacFlapCmd from the given packet.
SnacFlapCmd(long requestId, SnacCommand command)
          Creates a new SnacFlapCmd with the given request ID that uses the given SnacCommand to generate a SNAC packet to write (embedded in a FLAP packet, of course) to a FLAP connection.
 
Method Summary
 SnacPacket getSnacPacket()
          Returns the SNAC packet embedded in this command, if any.
 java.lang.String toString()
           
 void writeData(java.io.OutputStream out)
          Writes this command's FLAP data to the given stream.
 
Methods inherited from class FlapCommand
getChannel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHANNEL_SNAC

public static final int CHANNEL_SNAC
The channel on which SNAC commands reside.

See Also:
Constant Field Values
Constructor Detail

SnacFlapCmd

public SnacFlapCmd(FlapPacket flapPacket)
Generates a SnacFlapCmd from the given packet.

Parameters:
flapPacket - the packet from which this command is to be generated

SnacFlapCmd

public SnacFlapCmd(long requestId,
                   SnacCommand command)
Creates a new SnacFlapCmd with the given request ID that uses the given SnacCommand to generate a SNAC packet to write (embedded in a FLAP packet, of course) to a FLAP connection.

Parameters:
requestId - the request ID to use in this command's SNAC packet
command - the command to use to generate a SNAC packet upon writing to a FLAP connection
Method Detail

getSnacPacket

public final SnacPacket getSnacPacket()
Returns the SNAC packet embedded in this command, if any. (This may be null if an invalid SNAC packet was sent in a channel-2 FLAP.)

Returns:
this command's SNAC packet

writeData

public void writeData(java.io.OutputStream out)
               throws java.io.IOException
Description copied from class: FlapCommand
Writes this command's FLAP data to the given stream.

Specified by:
writeData in class FlapCommand
Parameters:
out - the stream to which the FLAP data should be written
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()