@InterfaceAudience.Private @InterfaceStability.Evolving public class PacketHeader extends Object
Modifier and Type | Field and Description |
---|---|
static int |
PKT_LENGTHS_LEN |
static int |
PKT_MAX_HEADER_LEN |
Constructor and Description |
---|
PacketHeader() |
PacketHeader(int packetLen,
long offsetInBlock,
long seqno,
boolean lastPacketInBlock,
int dataLen,
boolean syncBlock) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
byte[] |
getBytes() |
int |
getDataLen() |
long |
getOffsetInBlock() |
int |
getPacketLen() |
long |
getSeqno() |
int |
getSerializedSize() |
boolean |
getSyncBlock() |
int |
hashCode() |
boolean |
isLastPacketInBlock() |
void |
putInBuffer(ByteBuffer buf)
Write the header into the buffer.
|
void |
readFields(ByteBuffer buf) |
void |
readFields(DataInputStream in) |
boolean |
sanityCheck(long lastSeqNo)
Perform a sanity check on the packet, returning true if it is sane.
|
void |
setFieldsFromData(int packetLen,
byte[] headerData) |
String |
toString() |
void |
write(DataOutputStream out) |
public static final int PKT_LENGTHS_LEN
public static final int PKT_MAX_HEADER_LEN
public PacketHeader()
public PacketHeader(int packetLen, long offsetInBlock, long seqno, boolean lastPacketInBlock, int dataLen, boolean syncBlock)
public int getDataLen()
public boolean isLastPacketInBlock()
public long getSeqno()
public long getOffsetInBlock()
public int getPacketLen()
public boolean getSyncBlock()
public void setFieldsFromData(int packetLen, byte[] headerData) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public void readFields(ByteBuffer buf) throws IOException
IOException
public void readFields(DataInputStream in) throws IOException
IOException
public int getSerializedSize()
public void putInBuffer(ByteBuffer buf)
public void write(DataOutputStream out) throws IOException
IOException
public byte[] getBytes()
public boolean sanityCheck(long lastSeqNo)
lastSeqNo
- the previous sequence number received - we expect the current
sequence number to be larger by 1.Copyright © 2013 Apache Software Foundation. All rights reserved.