org.apache.hadoop.hdfs.protocol
Class DataTransferProtocol.PacketHeader
java.lang.Object
org.apache.hadoop.hdfs.protocol.DataTransferProtocol.PacketHeader
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
- Enclosing interface:
- DataTransferProtocol
public static class DataTransferProtocol.PacketHeader
- extends Object
- implements org.apache.hadoop.io.Writable
Header data for each packet that goes through the read/write pipelines.
PKT_HEADER_LEN
public static final int PKT_HEADER_LEN
- Header size for a packet
- See Also:
- Constant Field Values
DataTransferProtocol.PacketHeader
public DataTransferProtocol.PacketHeader()
DataTransferProtocol.PacketHeader
public DataTransferProtocol.PacketHeader(int packetLen,
long offsetInBlock,
long seqno,
boolean lastPacketInBlock,
int dataLen)
getDataLen
public int getDataLen()
isLastPacketInBlock
public boolean isLastPacketInBlock()
getSeqno
public long getSeqno()
getOffsetInBlock
public long getOffsetInBlock()
getPacketLen
public int getPacketLen()
toString
public String toString()
- Overrides:
toString
in class Object
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
readFields
public void readFields(ByteBuffer buf)
throws IOException
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
putInBuffer
public void putInBuffer(ByteBuffer buf)
- Write the header into the buffer.
This requires that PKT_HEADER_LEN bytes are available.
sanityCheck
public boolean sanityCheck(long lastSeqNo)
- Perform a sanity check on the packet, returning true if it is sane.
- Parameters:
lastSeqNo
- the previous sequence number received - we expect the current
sequence number to be larger by 1.
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2009 The Apache Software Foundation