com.enderak.procol.common.net
Class PacketFactory

java.lang.Object
  |
  +--com.enderak.procol.common.net.PacketFactory

public class PacketFactory
extends java.lang.Object

Generates packets to send

Author:
Justin Dieters

Field Summary
static int MAX_PRIORITY
          The maximum priority
static int MIN_PRIORITY
          The minimum priority
static int NORMAL_PRIORITY
          The normal priority
 
Constructor Summary
PacketFactory()
          Constructor for the PacketFactory object
 
Method Summary
 void addToQueue(int requestIn, byte[] dataIn, int priority)
          Adds a message to the queue, using a byte array for the data section
 void addToQueue(int requestIn, java.io.File fileIn, int priority)
          Adds a message to the queue, using an File for the data section
 void addToQueue(int requestIn, int priority)
          Adds a message to the queue with no data section
 void addToQueue(int requestIn, int dataIn, int priority)
          Adds a message to the queue, using an int for the data section
 void addToQueue(int requestIn, java.lang.String filePath, java.io.File fileIn, int priority)
          Adds a message to the queue, using an File and the File's path string for the data section
 void addToQueue(int requestIn, java.lang.String dataIn, int priority)
          Adds a message to the queue, using a String for the data section
 void addToQueue(int requestIn, java.net.URI fileURIIn, java.io.File fileIn, int priority)
          Adds a message to the queue, using an File and the File's URI for the data section
 void addToQueue(int requestIn, java.net.URI uriIn, int priority)
          Adds a message to the queue, using a URI for the data section
 ProColPacket getNext()
          Gets the next Packet from the queue
 boolean hasNext()
          Determines if there is another packet waiting
 void resetMessageNum()
          Resets the message number to zero
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PRIORITY

public static final int MAX_PRIORITY
The maximum priority

See Also:
Constant Field Values

MIN_PRIORITY

public static final int MIN_PRIORITY
The minimum priority

See Also:
Constant Field Values

NORMAL_PRIORITY

public static final int NORMAL_PRIORITY
The normal priority

See Also:
Constant Field Values
Constructor Detail

PacketFactory

public PacketFactory()
Constructor for the PacketFactory object

Method Detail

addToQueue

public void addToQueue(int requestIn,
                       int priority)
Adds a message to the queue with no data section

Parameters:
requestIn - The request code
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       java.lang.String dataIn,
                       int priority)
Adds a message to the queue, using a String for the data section

Parameters:
dataIn - The data
requestIn - The request code
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       java.net.URI uriIn,
                       int priority)
Adds a message to the queue, using a URI for the data section

Parameters:
requestIn - The request code
uriIn - the URI
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       byte[] dataIn,
                       int priority)
Adds a message to the queue, using a byte array for the data section

Parameters:
dataIn - The data
requestIn - The request code
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       int dataIn,
                       int priority)
Adds a message to the queue, using an int for the data section

Parameters:
dataIn - The data
requestIn - The request code
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       java.io.File fileIn,
                       int priority)
Adds a message to the queue, using an File for the data section

Parameters:
requestIn - The request code
fileIn - The file
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       java.net.URI fileURIIn,
                       java.io.File fileIn,
                       int priority)
Adds a message to the queue, using an File and the File's URI for the data section

Parameters:
requestIn - The request code
fileIn - The file
fileURIIn - The file URI
priority - The priority

addToQueue

public void addToQueue(int requestIn,
                       java.lang.String filePath,
                       java.io.File fileIn,
                       int priority)
Adds a message to the queue, using an File and the File's path string for the data section

Parameters:
requestIn - The request code
fileIn - The file
filePath - The file path
priority - The priority

getNext

public ProColPacket getNext()
Gets the next Packet from the queue

Returns:
The next packet

hasNext

public boolean hasNext()
Determines if there is another packet waiting

Returns:
true if there is another packet, false if not

resetMessageNum

public void resetMessageNum()
Resets the message number to zero