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
public abstract class BaseMessage extends SpyObject
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 Modifier and Type Field Description protected long
cas
private static int
CAS_OFFSET
protected byte
datatype
private static int
DATATYPE_OFFSET
protected byte
extralength
private static int
EXTRALENGTH_OFFSET
static int
HEADER_LENGTH
protected short
keylength
private static int
KEYLENGTH_OFFSET
protected TapMagic
magic
private static int
MAGIC_OFFSET
protected int
opaque
private static int
OPAQUE_OFFSET
protected TapOpcode
opcode
private static int
OPCODE_OFFSET
protected int
totalbody
private static int
TOTALBODY_OFFSET
protected short
vbucket
private static int
VBUCKET_OFFSET
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseMessage()
protected
BaseMessage(byte[] b)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
decodeInt(byte[] data, int i)
protected int
decodeIntHostOrder(byte[] data, int i)
protected long
decodeLong(byte[] data, int i)
protected short
decodeShort(byte[] data, int i)
abstract java.nio.ByteBuffer
getBytes()
Creates a ByteBuffer representation of the message.long
getCas()
Gets the value of the tap messages cas field.byte
getDatatype()
Gets the value of the tap messages data type field.byte
getExtralength()
Gets the value of the tap messages extra length field.short
getKeylength()
Gets the value of the tap messages key length field.TapMagic
getMagic()
Gets the value of the tap messages magic field.int
getMessageLength()
Gets the length of the entire message.int
getOpaque()
Gets the value of the tap messages opaque field.TapOpcode
getOpcode()
Gets the value of the tap messages opaque field.int
getTotalbody()
Gets the value of the tap messages total body field.short
getVbucket()
Gets the value of the tap messages vbucket field.void
setCas(long c)
Sets the value of the tap messages cas field.void
setDatatype(byte d)
Sets the value of the tap messages data type field.void
setExtralength(byte e)
Sets the value of the tap messages extra length field.void
setMagic(TapMagic m)
Sets the value of the tap messages magic field.void
setOpaque(int op)
Sets the value of the tap messages opaque field.void
setOpcode(TapOpcode o)
Sets the value of the tap messages opcode field.void
setTotalbody(int t)
Sets the value of the tap messages total body field.void
setVbucket(short vb)
Sets the value of the tap messages vbucket field.
-
-
-
Field Detail
-
MAGIC_OFFSET
private static final int MAGIC_OFFSET
- See Also:
- Constant Field Values
-
OPCODE_OFFSET
private static final int OPCODE_OFFSET
- See Also:
- Constant Field Values
-
KEYLENGTH_OFFSET
private static final int KEYLENGTH_OFFSET
- See Also:
- Constant Field Values
-
EXTRALENGTH_OFFSET
private static final int EXTRALENGTH_OFFSET
- See Also:
- Constant Field Values
-
DATATYPE_OFFSET
private static final int DATATYPE_OFFSET
- See Also:
- Constant Field Values
-
VBUCKET_OFFSET
private static final int VBUCKET_OFFSET
- See Also:
- Constant Field Values
-
TOTALBODY_OFFSET
private static final int TOTALBODY_OFFSET
- See Also:
- Constant Field Values
-
OPAQUE_OFFSET
private static final int OPAQUE_OFFSET
- See Also:
- Constant Field Values
-
CAS_OFFSET
private static final int CAS_OFFSET
- See Also:
- Constant Field Values
-
HEADER_LENGTH
public static final int HEADER_LENGTH
- See Also:
- Constant Field Values
-
magic
protected TapMagic magic
-
opcode
protected TapOpcode 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
-
-
Method Detail
-
setMagic
public final void setMagic(TapMagic m)
Sets the value of the tap messages magic field.- Parameters:
m
- The new value for the magic field.
-
getMagic
public final TapMagic getMagic()
Gets the value of the tap messages magic field.- Returns:
- The value of the magic field.
-
setOpcode
public final void setOpcode(TapOpcode o)
Sets the value of the tap messages opcode field.- Parameters:
o
- The new value of the opcode field.
-
getOpcode
public final TapOpcode 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
public abstract java.nio.ByteBuffer 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)
-
-