public class LegacyTranscoder extends AbstractTranscoder<LegacyDocument,java.lang.Object>
A Transcoder
which mimics the behavior of the Java SDK 1.* series for compatibility.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COMPRESSION_THRESHOLD |
Constructor and Description |
---|
LegacyTranscoder() |
LegacyTranscoder(int compressionThreshold) |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
compress(byte[] in) |
static long |
decodeLong(byte[] b) |
protected byte[] |
decompress(byte[] in) |
protected java.lang.Object |
deserialize(byte[] in) |
java.lang.Class<LegacyDocument> |
documentType() |
protected LegacyDocument |
doDecode(java.lang.String id,
com.couchbase.client.deps.io.netty.buffer.ByteBuf content,
long cas,
int expiry,
int flags,
com.couchbase.client.core.message.ResponseStatus status)
Perform the decoding of the received response.
|
protected com.couchbase.client.core.lang.Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,java.lang.Integer> |
doEncode(LegacyDocument document)
Perform the encoding of the request document.
|
static byte[] |
encodeNum(long l,
int maxBytes) |
LegacyDocument |
newDocument(java.lang.String id,
int expiry,
java.lang.Object content,
long cas) |
decode, encode
public static final int DEFAULT_COMPRESSION_THRESHOLD
public LegacyTranscoder()
public LegacyTranscoder(int compressionThreshold)
public java.lang.Class<LegacyDocument> documentType()
protected LegacyDocument doDecode(java.lang.String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, com.couchbase.client.core.message.ResponseStatus status) throws java.lang.Exception
AbstractTranscoder
Perform the decoding of the received response.
doDecode
in class AbstractTranscoder<LegacyDocument,java.lang.Object>
id
- the id of the document.content
- the encoded content of the document.cas
- the cas value of the document.expiry
- the expiration time of the document.flags
- the flags set on the document.status
- the response status.java.lang.Exception
- if something goes wrong during the decode process.public LegacyDocument newDocument(java.lang.String id, int expiry, java.lang.Object content, long cas)
protected com.couchbase.client.core.lang.Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,java.lang.Integer> doEncode(LegacyDocument document) throws java.lang.Exception
AbstractTranscoder
Perform the encoding of the request document.
doEncode
in class AbstractTranscoder<LegacyDocument,java.lang.Object>
document
- the document to encode.java.lang.Exception
- if something goes wrong during the encode process.public static byte[] encodeNum(long l, int maxBytes)
public static long decodeLong(byte[] b)
protected java.lang.Object deserialize(byte[] in)
protected byte[] compress(byte[] in)
protected byte[] decompress(byte[] in)