public class FilePart 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 long |
offset |
private static int |
OFFSET_POSITION |
private byte[] |
partialContent |
PAYLOAD_SIZE_POSITION, PAYLOAD_START_POSITION, requestResponseCode| Modifier | Constructor and Description |
|---|---|
protected |
FilePart(byte[] packet)
Constructor (typically used by client) with Packet received as parameter.
|
|
FilePart(java.lang.String filename,
long offset,
byte[] partialContent)
Constructor (typically used by server) with informations about file part to send as parameters.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFilename()
filename getter.
|
private int |
getFilenameSize(byte[] packet)
Read filename’s size from Packet.
|
long |
getOffset()
offset getter.
|
byte[] |
getPartialContent()
partialContent getter.
|
private void |
setFilename(byte[] packet)
Write from Packet into filename.
|
private void |
setOffset(byte[] packet)
Write from Packet into offset.
|
private void |
setPartialContent(byte[] packet)
Write from Packet into partialContent.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
getPayloadSize, getRequestResponseCode, setPayloadSizeprivate java.lang.String filename
private long offset
private byte[] partialContent
private static final int OFFSET_POSITION
private static final int FILENAME_SIZE_POSITION
private static final int FILENAME_POSITION
public FilePart(java.lang.String filename,
long offset,
byte[] partialContent)
throws InternalError
filename - name of the file to sendtotalSize - total size of the file to sendoffset - where in the file begins the part we are sendingpartialContent - content of the file we sendInternalErrorprotected FilePart(byte[] packet)
throws TransmissionError,
SizeError,
ProtocolError,
InternalError
packet - the full Packet receivedSizeErrorInternalErrorTransmissionErrorProtocolErrorprotected byte[] toPacket()
throws InternalError
toPacket in class PayloadInternalErrorprivate void setOffset(byte[] packet)
throws SizeError
packet - received PacketSizeErrorprivate int getFilenameSize(byte[] packet)
throws SizeError,
ProtocolError
packet - received PacketProtocolErrorSizeErrorprivate void setFilename(byte[] packet)
throws ProtocolError,
SizeError,
InternalError
packet - received PacketProtocolErrorSizeErrorInternalErrorprivate void setPartialContent(byte[] packet)
throws ProtocolError,
SizeError
packet - received PacketSizeErrorProtocolErrorpublic byte[] getPartialContent()
public java.lang.String getFilename()
public long getOffset()