public class HashRequest extends Payload
Modifier and Type | Field and Description |
---|---|
private HashAlgorithm[] |
algoList |
private java.lang.String |
filename |
private static int |
FILENAME_POSITION |
private static int |
FILENAME_SIZE_POSITION |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode
Modifier | Constructor and Description |
---|---|
protected |
HashRequest(byte[] packet)
Constructor (typically used by client) with a byte[] parameter containing the Packet received.
|
|
HashRequest(java.lang.String filename,
HashAlgorithm[] algoList)
Constructor (typically used by the server) with a filename parameter.
|
Modifier and Type | Method and Description |
---|---|
HashAlgorithm[] |
getAlgoList()
AlgoList getter.
|
java.lang.String |
getFilename()
Filename getter.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSize
private java.lang.String filename
private HashAlgorithm[] algoList
private static final int FILENAME_SIZE_POSITION
private static final int FILENAME_POSITION
public HashRequest(java.lang.String filename, HashAlgorithm[] algoList) throws InternalError
filename
- name of the file to download. Must not be empty.algoList
- List of hash algorithms usedInternalError
protected HashRequest(byte[] packet) throws TransmissionError, SizeError, ProtocolError, InternalError
packet
- the full Packet receivedSizeError
InternalError
ProtocolError
TransmissionError
protected byte[] toPacket() throws InternalError
toPacket
in class Payload
InternalError
public HashAlgorithm[] getAlgoList()
public java.lang.String getFilename()