public class LoadRequest 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 HostItem |
hostItem |
private static int |
MAX_SIZE_PARTIAL_CONTENT_POSITION |
private long |
maxSizePartialContent |
private long |
offset |
private static int |
OFFSET_POSITION |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode
Modifier | Constructor and Description |
---|---|
protected |
LoadRequest(byte[] packet)
Constructor (typically used by server) with a byte[] parameter containing the Packet received.
|
|
LoadRequest(java.lang.String filename,
long offset,
long maxSizePartialContent,
HostItem hostItem)
Constructor (typically used by the client) with a filename parameter.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilename()
filename getter.
|
HostItem |
getHostItem()
hostItem getter.
|
long |
getMaxSizePartialContent()
maxSizePartialContent getter.
|
long |
getOffset()
offset getter.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSize
private java.lang.String filename
private long maxSizePartialContent
private long offset
private HostItem hostItem
private static final int OFFSET_POSITION
private static final int MAX_SIZE_PARTIAL_CONTENT_POSITION
private static final int FILENAME_SIZE_POSITION
private static final int FILENAME_POSITION
public LoadRequest(java.lang.String filename, long offset, long maxSizePartialContent, HostItem hostItem) throws InternalError
filename
- name of the file to download. Must not be empty.offset
- offset of the blocmaxSizePartialContent
- partial content in response should not excess this size, but this can be less (by example if endoffile is reached or server doesn't have the full block requested)hostItem
- hostItem used by the client to register on the trackerInternalError
protected LoadRequest(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 java.lang.String getFilename()
public long getOffset()
public long getMaxSizePartialContent()
public HostItem getHostItem()