com.hazelcast.nio
public final class Packet extends Object implements SocketWritable, SocketReadable
Modifier and Type | Field and Description |
---|---|
static int |
HEADER_BIND |
static int |
HEADER_EVENT |
static int |
HEADER_OP |
static int |
HEADER_RESPONSE |
static int |
HEADER_URGENT |
static int |
HEADER_WAN_REPLICATION |
static byte |
VERSION |
Constructor and Description |
---|
Packet() |
Packet(Data data) |
Packet(Data data,
int partitionId) |
Modifier and Type | Method and Description |
---|---|
boolean |
done() |
Connection |
getConn()
Gets the Connection this Packet was send with.
|
Data |
getData() |
short |
getHeader()
Returns the header of the Packet.
|
int |
getPartitionId()
Returns the partition id of this packet.
|
boolean |
isHeaderSet(int bit) |
boolean |
isUrgent()
Checks if this SocketWritable is urgent.
|
boolean |
readFrom(ByteBuffer source) |
void |
reset() |
void |
setConn(Connection conn)
Sets the Connection this Packet is send with.
|
void |
setData(Data data) |
void |
setHeader(int bit) |
int |
size()
Returns an estimation of the packet, including its payload, in bytes.
|
String |
toString() |
boolean |
writeTo(ByteBuffer destination)
Asks the SocketWritable to write its content to the destination ByteBuffer.
|
public static final byte VERSION
public static final int HEADER_OP
public static final int HEADER_RESPONSE
public static final int HEADER_EVENT
public static final int HEADER_WAN_REPLICATION
public static final int HEADER_URGENT
public static final int HEADER_BIND
public Packet()
public Packet(Data data)
public Packet(Data data, int partitionId)
public Connection getConn()
public void setConn(Connection conn)
conn
- the connection.public void setHeader(int bit)
public boolean isHeaderSet(int bit)
public short getHeader()
public int getPartitionId()
public boolean isUrgent()
SocketWritable
isUrgent
in interface SocketWritable
public boolean writeTo(ByteBuffer destination)
SocketWritable
writeTo
in interface SocketWritable
destination
- the ByteBuffer to write to.public boolean readFrom(ByteBuffer source)
readFrom
in interface SocketReadable
public int size()
public Data getData()
public void setData(Data data)
public boolean done()
public void reset()
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.