public class PartiallyReceivedBlock
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
PartiallyReceivedBlock.PacketReceivedListener |
Modifier and Type | Field and Description |
---|---|
int |
_packets |
int |
_packetSize |
Constructor and Description |
---|
PartiallyReceivedBlock(int packets,
int packetSize) |
PartiallyReceivedBlock(int packets,
int packetSize,
byte[] data) |
Modifier and Type | Method and Description |
---|---|
byte[] |
abort(int reason,
java.lang.String description,
boolean cancelledLocally)
Abort the transfer.
|
boolean |
abortedLocally() |
java.util.Deque<java.lang.Integer> |
addListener(PartiallyReceivedBlock.PacketReceivedListener listener) |
void |
addPacket(int position,
Buffer packet) |
boolean |
allReceived() |
boolean |
allReceivedAndNotAborted() |
java.lang.String |
getAbortDescription() |
int |
getAbortReason() |
byte[] |
getBlock() |
int |
getNumPackets() |
Buffer |
getPacket(int x) |
int |
getPacketSize() |
boolean |
isAborted() |
boolean |
isReceived(int packetNo) |
void |
removeListener(PartiallyReceivedBlock.PacketReceivedListener listener) |
public PartiallyReceivedBlock(int packets, int packetSize, byte[] data)
public PartiallyReceivedBlock(int packets, int packetSize)
public java.util.Deque<java.lang.Integer> addListener(PartiallyReceivedBlock.PacketReceivedListener listener) throws AbortedException
AbortedException
public boolean isReceived(int packetNo) throws AbortedException
AbortedException
public int getNumPackets() throws AbortedException
AbortedException
public int getPacketSize() throws AbortedException
AbortedException
public void addPacket(int position, Buffer packet) throws AbortedException
AbortedException
public boolean allReceivedAndNotAborted()
public boolean allReceived() throws AbortedException
AbortedException
public byte[] getBlock() throws AbortedException
AbortedException
public Buffer getPacket(int x) throws AbortedException
AbortedException
public void removeListener(PartiallyReceivedBlock.PacketReceivedListener listener)
public byte[] abort(int reason, java.lang.String description, boolean cancelledLocally)
reason
- description
- cancelledLocally
- If true, the transfer was deliberately aborted by *this node*,
not as the result of a timeout.public boolean isAborted()
public int getAbortReason()
public java.lang.String getAbortDescription()
public boolean abortedLocally()