public class RatioResponse extends Payload
Modifier and Type | Field and Description |
---|---|
private HostItem |
hostItem |
private static int |
HOSTNAME_START_POSITION |
private static int |
PORT_START_POSITION |
private static int |
TOTAL_DOWN_START_POSITION |
private static int |
TOTAL_UP_START_POSITION |
private long |
totalDown |
private long |
totalUp |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode
Modifier | Constructor and Description |
---|---|
protected |
RatioResponse(byte[] packet)
Constructor (typically used by client/server) with a byte[] parameter containing the Packet received.
|
|
RatioResponse(HostItem hostItem,
long totalUp,
long totalDown)
Constructor with hostItem (typically used by tracker)
|
Modifier and Type | Method and Description |
---|---|
HostItem |
getHostItem()
HostItem getter.
|
long |
getTotalDown()
totalDown getter.
|
long |
getTotalUp()
totalUp getter.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSize
private HostItem hostItem
private long totalUp
private long totalDown
private static final int TOTAL_UP_START_POSITION
private static final int TOTAL_DOWN_START_POSITION
private static final int PORT_START_POSITION
private static final int HOSTNAME_START_POSITION
public RatioResponse(HostItem hostItem, long totalUp, long totalDown) throws InternalError
hostItem
- Host to get ratio of.totalUp
- total bytes uploadedtotalDown
- total bytes downloadedInternalError
protected RatioResponse(byte[] packet) throws SizeError, ProtocolError, InternalError, TransmissionError
packet
- the full Packet receivedSizeError
InternalError
ProtocolError
TransmissionError
protected byte[] toPacket() throws InternalError
toPacket
in class Payload
InternalError
public HostItem getHostItem()
public long getTotalUp()
public long getTotalDown()