public class DiscoverResponse extends Payload
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
filename |
private static int |
FILENAME_POSITION |
private static int |
FILENAME_SIZE_POSITION |
private java.util.List<HostItem> |
hostList |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode
Modifier | Constructor and Description |
---|---|
protected |
DiscoverResponse(byte[] packet)
Constructor (typically used by server) with a byte[] parameter containing the Packet received.
|
|
DiscoverResponse(java.lang.String filename,
java.util.List<HostItem> hostList)
Constructor with filename (typically used by tracker).
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilename()
Filename getter.
|
java.util.List<HostItem> |
getHostList()
HostList getter.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSize
private java.util.List<HostItem> hostList
private java.lang.String filename
private static final int FILENAME_SIZE_POSITION
private static final int FILENAME_POSITION
public DiscoverResponse(java.lang.String filename, java.util.List<HostItem> hostList) throws InternalError
filename
- Name of the file related to the server list.hostList
- List of serversInternalError
protected DiscoverResponse(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 java.util.List<HostItem> getHostList()
public java.lang.String getFilename()