public class UtpPacket extends Object
| Constructor and Description |
|---|
UtpPacket() |
UtpPacket(UtpSocketImpl socket,
IPayload payload)
Creates a new UtpPacket which will be send.
|
UtpPacket(UtpSocketImpl socket,
IPayload payload,
boolean isSynResponse)
Creates a new UtpPacket which will be send.
|
| Modifier and Type | Method and Description |
|---|---|
short |
getAcknowledgeNumber() |
short |
getConnectionId() |
int |
getPacketSize() |
int |
getSentTime() |
short |
getSequenceNumber() |
int |
getTimesSent() |
int |
getTimestampDifferenceMicroseconds() |
int |
getTimestampMicroseconds() |
byte |
getType() |
byte |
getVersion() |
int |
getWindowSize() |
boolean |
hasExtensions() |
void |
processPayload(UtpSocketImpl socket)
Processes the payload information.
|
void |
read(InStream inStream,
UtpPayloadFactory payloadFactory)
Reads the packet including the payload.
|
byte[] |
repackage(UtpSocketImpl socket)
Modifies this packet to become half the size of the original size.
|
String |
toString() |
void |
updateSentTime()
Updates the time at which this packet was sent and increments the amount of times it is send.
|
void |
write(UtpSocketImpl socket,
OutStream outStream)
Writes the packet including the payload.
|
public UtpPacket()
public UtpPacket(UtpSocketImpl socket, IPayload payload)
socket - The socket on which this packet will be send.payload - The payload which will be send with this packet.public UtpPacket(UtpSocketImpl socket, IPayload payload, boolean isSynResponse)
socket - The socket on which this packet will be send.payload - The payload which will be send with this packet.isSynResponse - If this packet is a repsonse to SynPayload.public void read(InStream inStream, UtpPayloadFactory payloadFactory)
inStream - The stream from which the packet must be read.payloadFactory - The payload factory to read the payload data.public void write(UtpSocketImpl socket, OutStream outStream)
socket - The socket for which this packet will be written.outStream - The stream on which the packet will be written.public byte[] repackage(UtpSocketImpl socket)
socket - The socket on which this packet is being send.public void updateSentTime()
public void processPayload(UtpSocketImpl socket) throws IOException
socket - The socket which received the packet.IOExceptionpublic short getConnectionId()
public short getAcknowledgeNumber()
public short getSequenceNumber()
public int getWindowSize()
public int getTimestampMicroseconds()
public int getTimestampDifferenceMicroseconds()
public boolean hasExtensions()
true when the extension indication field is non-zero.public byte getVersion()
public int getPacketSize()
public int getSentTime()
public int getTimesSent()
public byte getType()
UtpProtocolCopyright © 2016. All rights reserved.