public class HashResponse 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.Map<HashAlgorithm,byte[]> |
hashes |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode| Modifier | Constructor and Description |
|---|---|
protected |
HashResponse(byte[] packet)
Constructor (typically used by client) with a byte[] parameter containing the Packet received.
|
|
HashResponse(java.lang.String filename,
java.util.Map<HashAlgorithm,byte[]> hashes)
Constructor (typically used by the server) with a filename parameter.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFilename()
filename getter.
|
byte[] |
getHash(HashAlgorithm hashAlgo)
hash getter
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSizeprivate java.lang.String filename
private java.util.Map<HashAlgorithm,byte[]> hashes
private static final int FILENAME_SIZE_POSITION
private static final int FILENAME_POSITION
public HashResponse(java.lang.String filename,
java.util.Map<HashAlgorithm,byte[]> hashes)
throws InternalError
filename - name of the file to download. Must not be empty.hashes - HashMap containing hashes for file.InternalErrorprotected HashResponse(byte[] packet)
throws TransmissionError,
SizeError,
ProtocolError,
InternalError
packet - the full Packet receivedSizeErrorInternalErrorProtocolErrorTransmissionErrorprotected byte[] toPacket()
throws InternalError
toPacket in class PayloadInternalErrorpublic byte[] getHash(HashAlgorithm hashAlgo)
hashAlgo - HashAlgorithm to return hash frompublic java.lang.String getFilename()