Package net.spy.memcached.tapmessage
Class BaseMessage
java.lang.Object
net.spy.memcached.compat.SpyObject
net.spy.memcached.tapmessage.BaseMessage
- Direct Known Subclasses:
RequestMessage,ResponseMessage
The BaseMessage implements the header of a tap message. This class cannot be
instantiated. Tap stream messages are created with the RequestMessage and
ResponseMessage classes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intdecodeInt(byte[] data, int i) protected intdecodeIntHostOrder(byte[] data, int i) protected longdecodeLong(byte[] data, int i) protected shortdecodeShort(byte[] data, int i) abstract ByteBuffergetBytes()Creates a ByteBuffer representation of the message.final longgetCas()Gets the value of the tap messages cas field.final byteGets the value of the tap messages data type field.final byteGets the value of the tap messages extra length field.final shortGets the value of the tap messages key length field.final TapMagicgetMagic()Gets the value of the tap messages magic field.final intGets the length of the entire message.final intGets the value of the tap messages opaque field.final TapOpcodeGets the value of the tap messages opaque field.final intGets the value of the tap messages total body field.final shortGets the value of the tap messages vbucket field.final voidsetCas(long c) Sets the value of the tap messages cas field.final voidsetDatatype(byte d) Sets the value of the tap messages data type field.final voidsetExtralength(byte e) Sets the value of the tap messages extra length field.final voidSets the value of the tap messages magic field.final voidsetOpaque(int op) Sets the value of the tap messages opaque field.final voidSets the value of the tap messages opcode field.final voidsetTotalbody(int t) Sets the value of the tap messages total body field.final voidsetVbucket(short vb) Sets the value of the tap messages vbucket field.
-
Field Details
-
HEADER_LENGTH
public static final int HEADER_LENGTH- See Also:
-
magic
-
opcode
-
keylength
protected short keylength -
extralength
protected byte extralength -
datatype
protected byte datatype -
vbucket
protected short vbucket -
totalbody
protected int totalbody -
opaque
protected int opaque -
cas
protected long cas
-
-
Constructor Details
-
BaseMessage
protected BaseMessage() -
BaseMessage
protected BaseMessage(byte[] b)
-
-
Method Details
-
setMagic
Sets the value of the tap messages magic field.- Parameters:
m- The new value for the magic field.
-
getMagic
Gets the value of the tap messages magic field.- Returns:
- The value of the magic field.
-
setOpcode
Sets the value of the tap messages opcode field.- Parameters:
o- The new value of the opcode field.
-
getOpcode
Gets the value of the tap messages opaque field.- Returns:
- The value of the opaque field.
-
getKeylength
public final short getKeylength()Gets the value of the tap messages key length field.- Returns:
- The value of the key length field.
-
setDatatype
public final void setDatatype(byte d) Sets the value of the tap messages data type field.- Parameters:
d- The new value for the data type field.
-
getDatatype
public final byte getDatatype()Gets the value of the tap messages data type field.- Returns:
- The value of the data type field.
-
setExtralength
public final void setExtralength(byte e) Sets the value of the tap messages extra length field.- Parameters:
e- The new value for the extra length field.
-
getExtralength
public final byte getExtralength()Gets the value of the tap messages extra length field.- Returns:
- The value of the extra length field.
-
setVbucket
public final void setVbucket(short vb) Sets the value of the tap messages vbucket field.- Parameters:
vb- The new value for the vbucket field.
-
getVbucket
public final short getVbucket()Gets the value of the tap messages vbucket field.- Returns:
- The value of the vbucket field.
-
setTotalbody
public final void setTotalbody(int t) Sets the value of the tap messages total body field.- Parameters:
t- The new value for the total body field.
-
getTotalbody
public final int getTotalbody()Gets the value of the tap messages total body field.- Returns:
- The value of the total body field.
-
setOpaque
public final void setOpaque(int op) Sets the value of the tap messages opaque field.- Parameters:
op- The new value for the opaque field.
-
getOpaque
public final int getOpaque()Gets the value of the tap messages opaque field.- Returns:
- The value of the opaque field.
-
setCas
public final void setCas(long c) Sets the value of the tap messages cas field.- Parameters:
c- The new value for the cas field.
-
getCas
public final long getCas()Gets the value of the tap messages cas field.- Returns:
- The value of the cas field.
-
getMessageLength
public final int getMessageLength()Gets the length of the entire message.- Returns:
- The length of the message.
-
getBytes
Creates a ByteBuffer representation of the message.- Returns:
- The ByteBuffer representation of the message.
-
decodeShort
protected short decodeShort(byte[] data, int i) -
decodeInt
protected int decodeInt(byte[] data, int i) -
decodeIntHostOrder
protected int decodeIntHostOrder(byte[] data, int i) -
decodeLong
protected long decodeLong(byte[] data, int i)
-