jSyncManager

org.jSyncManager.API.Protocol
Class SmallArgument

java.lang.Object
  extended byorg.jSyncManager.API.Protocol.Argument
      extended byorg.jSyncManager.API.Protocol.ShortArgument
          extended byorg.jSyncManager.API.Protocol.SmallArgument
All Implemented Interfaces:
java.io.Serializable

class SmallArgument
extends ShortArgument
implements java.io.Serializable

The Small Argument type. This argument type is for arguments that are at most 65 536 bytes in length.


Field Summary
(package private)  byte argumentID
          A field to hold this arguments ID number.
(package private)  char argumentSize
          The size of the argument.
(package private)  byte[] data
          The data contained by this argument.
static byte FIRST_ARG_ID
          The ID number for the first argument in any packet containing arguments.
 
Constructor Summary
(package private) SmallArgument()
          Constructs a new Small Argument object.
(package private) SmallArgument(byte[] inData)
          Constructs a new argument from the specified data.
 
Method Summary
(package private)  byte[] arg2Bytes()
          Converts this argument into an array of bytes.
static Argument createArgument(byte[] data, int i)
          Creates an argument from a byte array.
(package private)  byte[] getArgument()
          Gets this arguments data as an array of bytes.
(package private)  int getSize()
          Retreives the size of this argument.
static Argument parseArgument(byte[] inData)
          Parses a byte array representing an argument into its corresponding Argument object.
static Argument[] parseArguments(int i, byte[] data)
          Parses a series of arguments into an array of argument objects.
 java.lang.String toString()
          Convert this object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

argumentSize

char argumentSize
The size of the argument.


argumentID

byte argumentID
A field to hold this arguments ID number.


data

byte[] data
The data contained by this argument.


FIRST_ARG_ID

public static final byte FIRST_ARG_ID
The ID number for the first argument in any packet containing arguments.

See Also:
Constant Field Values
Constructor Detail

SmallArgument

SmallArgument()
Constructs a new Small Argument object.


SmallArgument

SmallArgument(byte[] inData)
Constructs a new argument from the specified data. As this class is abstract, direct calls to this constructor will fail.

Method Detail

arg2Bytes

byte[] arg2Bytes()
Converts this argument into an array of bytes.

Specified by:
arg2Bytes in class Argument
Returns:
a byte array representation of this argument.

getSize

int getSize()
Retreives the size of this argument.

Specified by:
getSize in class Argument
Returns:
the size of this argument.

getArgument

byte[] getArgument()
Gets this arguments data as an array of bytes. Calls to this method differ from arg2Bytes in that where it returns the full bytes of the argument (including any header information), calls to this method will return only the data that this argument contains.

Specified by:
getArgument in class Argument
Returns:
an array of bytes containing this argument objects data.

toString

public java.lang.String toString()
Convert this object to a human-readable String.

Overrides:
toString in class ShortArgument
Returns:
this object to a human-readable String.

createArgument

public static Argument createArgument(byte[] data,
                                      int i)
Creates an argument from a byte array. This method will construct the proper Argument subclass according to the size of the input data.

Parameters:
data - the data to be included in the argument.
i - the ID of the first argument in this packet.
Returns:
the Argument object representing the input data.

parseArgument

public static Argument parseArgument(byte[] inData)
Parses a byte array representing an argument into its corresponding Argument object.

Parameters:
inData - the input byte array to be parsed.
Returns:
the argument object representing by the input data.

parseArguments

public static Argument[] parseArguments(int i,
                                        byte[] data)
Parses a series of arguments into an array of argument objects.

Parameters:
i - the number of arguments to parse.
data - the input data array.

jSyncManager

Copyright (c) 1999 - 2004 Brad BARCLAY and others. All Rights Reserved.