Class AbstractBinaryMemcacheMessage
- java.lang.Object
-
- com.couchbase.client.deps.io.netty.handler.codec.memcache.AbstractMemcacheObject
-
- com.couchbase.client.deps.io.netty.handler.codec.memcache.binary.AbstractBinaryMemcacheMessage
-
- All Implemented Interfaces:
BinaryMemcacheMessage
,MemcacheMessage
,MemcacheObject
,ReferenceCounted
- Direct Known Subclasses:
DefaultBinaryMemcacheRequest
,DefaultBinaryMemcacheResponse
public abstract class AbstractBinaryMemcacheMessage extends AbstractMemcacheObject implements BinaryMemcacheMessage
Default implementation of aBinaryMemcacheMessage
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractBinaryMemcacheMessage(byte[] key, ByteBuf extras)
Create a new instance with all properties set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCAS()
Returns the CAS identifier.byte
getDataType()
Returns the data type of the message.ByteBuf
getExtras()
Returns aByteBuf
representation of the optional extras.byte
getExtrasLength()
Return the extras length of the message.ByteBuf
getFramingExtras()
Returns aByteBuf
representation of the optional framing extras.byte
getFramingExtrasLength()
Return the framing extras length of the message.byte[]
getKey()
Returns the optional key of the document.short
getKeyLength()
Returns the key length of the message.byte
getMagic()
Returns the magic byte for the message.int
getOpaque()
Returns the opaque value.byte
getOpcode()
Returns the opcode for the message.int
getTotalBodyLength()
Returns the total body length.int
refCnt()
boolean
release()
boolean
release(int decrement)
BinaryMemcacheMessage
retain()
BinaryMemcacheMessage
retain(int increment)
BinaryMemcacheMessage
setCAS(long cas)
Sets the CAS identifier.BinaryMemcacheMessage
setDataType(byte dataType)
Sets the data type of the message.BinaryMemcacheMessage
setExtras(ByteBuf extras)
Sets the extras buffer on the message.BinaryMemcacheMessage
setExtrasLength(byte extrasLength)
Set the extras length of the message.BinaryMemcacheMessage
setFramingExtras(ByteBuf framingExtras)
Sets the framing extras buffer on the message.BinaryMemcacheMessage
setFramingExtrasLength(byte framingExtrasLength)
Set the framing extras length of the message.BinaryMemcacheMessage
setKey(byte[] key)
Sets the key of the document.BinaryMemcacheMessage
setKeyLength(short keyLength)
Set the key length of the message.BinaryMemcacheMessage
setMagic(byte magic)
Sets the magic byte.BinaryMemcacheMessage
setOpaque(int opaque)
Sets the opaque value.BinaryMemcacheMessage
setOpcode(byte opcode)
Sets the opcode for the message.BinaryMemcacheMessage
setTotalBodyLength(int totalBodyLength)
Sets the total body length.-
Methods inherited from class com.couchbase.client.deps.io.netty.handler.codec.memcache.AbstractMemcacheObject
getDecoderResult, setDecoderResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.deps.io.netty.handler.codec.memcache.MemcacheObject
getDecoderResult, setDecoderResult
-
-
-
-
Constructor Detail
-
AbstractBinaryMemcacheMessage
protected AbstractBinaryMemcacheMessage(byte[] key, ByteBuf extras)
Create a new instance with all properties set.- Parameters:
key
- the message key.extras
- the message extras.
-
-
Method Detail
-
getKey
public byte[] getKey()
Description copied from interface:BinaryMemcacheMessage
Returns the optional key of the document.- Specified by:
getKey
in interfaceBinaryMemcacheMessage
- Returns:
- the key of the document.
-
getExtras
public ByteBuf getExtras()
Description copied from interface:BinaryMemcacheMessage
Returns aByteBuf
representation of the optional extras.- Specified by:
getExtras
in interfaceBinaryMemcacheMessage
- Returns:
- the optional extras.
-
setKey
public BinaryMemcacheMessage setKey(byte[] key)
Description copied from interface:BinaryMemcacheMessage
Sets the key of the document.- Specified by:
setKey
in interfaceBinaryMemcacheMessage
- Parameters:
key
- the key of the message.
-
setExtras
public BinaryMemcacheMessage setExtras(ByteBuf extras)
Description copied from interface:BinaryMemcacheMessage
Sets the extras buffer on the message.- Specified by:
setExtras
in interfaceBinaryMemcacheMessage
- Parameters:
extras
- the extras buffer of the document.
-
getMagic
public byte getMagic()
Description copied from interface:BinaryMemcacheMessage
Returns the magic byte for the message.- Specified by:
getMagic
in interfaceBinaryMemcacheMessage
- Returns:
- the magic byte.
-
setMagic
public BinaryMemcacheMessage setMagic(byte magic)
Description copied from interface:BinaryMemcacheMessage
Sets the magic byte.- Specified by:
setMagic
in interfaceBinaryMemcacheMessage
- Parameters:
magic
- the magic byte to use.- See Also:
for typesafe opcodes.
-
getCAS
public long getCAS()
Description copied from interface:BinaryMemcacheMessage
Returns the CAS identifier.- Specified by:
getCAS
in interfaceBinaryMemcacheMessage
- Returns:
- the CAS identifier.
-
setCAS
public BinaryMemcacheMessage setCAS(long cas)
Description copied from interface:BinaryMemcacheMessage
Sets the CAS identifier.- Specified by:
setCAS
in interfaceBinaryMemcacheMessage
- Parameters:
cas
- the CAS identifier to use.
-
getOpaque
public int getOpaque()
Description copied from interface:BinaryMemcacheMessage
Returns the opaque value.- Specified by:
getOpaque
in interfaceBinaryMemcacheMessage
- Returns:
- the opaque value.
-
setOpaque
public BinaryMemcacheMessage setOpaque(int opaque)
Description copied from interface:BinaryMemcacheMessage
Sets the opaque value.- Specified by:
setOpaque
in interfaceBinaryMemcacheMessage
- Parameters:
opaque
- the opqaue value to use.
-
getTotalBodyLength
public int getTotalBodyLength()
Description copied from interface:BinaryMemcacheMessage
Returns the total body length. Note that this may be 0, since the body is optional.- Specified by:
getTotalBodyLength
in interfaceBinaryMemcacheMessage
- Returns:
- the total body length.
-
setTotalBodyLength
public BinaryMemcacheMessage setTotalBodyLength(int totalBodyLength)
Description copied from interface:BinaryMemcacheMessage
Sets the total body length. Note that this may be 0, since the body length is optional.- Specified by:
setTotalBodyLength
in interfaceBinaryMemcacheMessage
- Parameters:
totalBodyLength
- the total body length.
-
getDataType
public byte getDataType()
Description copied from interface:BinaryMemcacheMessage
Returns the data type of the message.- Specified by:
getDataType
in interfaceBinaryMemcacheMessage
- Returns:
- the data type of the message.
-
setDataType
public BinaryMemcacheMessage setDataType(byte dataType)
Description copied from interface:BinaryMemcacheMessage
Sets the data type of the message.- Specified by:
setDataType
in interfaceBinaryMemcacheMessage
- Parameters:
dataType
- the data type of the message.
-
getExtrasLength
public byte getExtrasLength()
Description copied from interface:BinaryMemcacheMessage
Return the extras length of the message. This may be 0, since the extras content is optional.- Specified by:
getExtrasLength
in interfaceBinaryMemcacheMessage
- Returns:
- the extras length.
-
setExtrasLength
public BinaryMemcacheMessage setExtrasLength(byte extrasLength)
Description copied from interface:BinaryMemcacheMessage
Set the extras length of the message. This may be 0, since the extras content is optional.- Specified by:
setExtrasLength
in interfaceBinaryMemcacheMessage
- Parameters:
extrasLength
- the extras length.
-
getKeyLength
public short getKeyLength()
Description copied from interface:BinaryMemcacheMessage
Returns the key length of the message. This may return 0, since the key is optional.- Specified by:
getKeyLength
in interfaceBinaryMemcacheMessage
- Returns:
- the key length.
-
setKeyLength
public BinaryMemcacheMessage setKeyLength(short keyLength)
Description copied from interface:BinaryMemcacheMessage
Set the key length of the message. This may be 0, since the key is optional.- Specified by:
setKeyLength
in interfaceBinaryMemcacheMessage
- Parameters:
keyLength
- the key length to use.
-
getOpcode
public byte getOpcode()
Description copied from interface:BinaryMemcacheMessage
Returns the opcode for the message.- Specified by:
getOpcode
in interfaceBinaryMemcacheMessage
- Returns:
- the opcode.
-
setOpcode
public BinaryMemcacheMessage setOpcode(byte opcode)
Description copied from interface:BinaryMemcacheMessage
Sets the opcode for the message.- Specified by:
setOpcode
in interfaceBinaryMemcacheMessage
- Parameters:
opcode
- the opcode to use.
-
getFramingExtras
public ByteBuf getFramingExtras()
Description copied from interface:BinaryMemcacheMessage
Returns aByteBuf
representation of the optional framing extras.- Specified by:
getFramingExtras
in interfaceBinaryMemcacheMessage
- Returns:
- the optional framing extras.
-
setFramingExtras
public BinaryMemcacheMessage setFramingExtras(ByteBuf framingExtras)
Description copied from interface:BinaryMemcacheMessage
Sets the framing extras buffer on the message.- Specified by:
setFramingExtras
in interfaceBinaryMemcacheMessage
- Parameters:
framingExtras
- the framing extras buffer of the document.
-
getFramingExtrasLength
public byte getFramingExtrasLength()
Description copied from interface:BinaryMemcacheMessage
Return the framing extras length of the message. This may be 0, since the extras content is optional.- Specified by:
getFramingExtrasLength
in interfaceBinaryMemcacheMessage
- Returns:
- the framing extras length.
-
setFramingExtrasLength
public BinaryMemcacheMessage setFramingExtrasLength(byte framingExtrasLength)
Description copied from interface:BinaryMemcacheMessage
Set the framing extras length of the message. This may be 0, since the extras content is optional.- Specified by:
setFramingExtrasLength
in interfaceBinaryMemcacheMessage
- Parameters:
framingExtrasLength
- the framing extras length.
-
refCnt
public int refCnt()
- Specified by:
refCnt
in interfaceReferenceCounted
-
retain
public BinaryMemcacheMessage retain()
- Specified by:
retain
in interfaceReferenceCounted
-
retain
public BinaryMemcacheMessage retain(int increment)
- Specified by:
retain
in interfaceReferenceCounted
-
release
public boolean release()
- Specified by:
release
in interfaceReferenceCounted
-
release
public boolean release(int decrement)
- Specified by:
release
in interfaceReferenceCounted
-
-