public class LegacyTranscoder extends AbstractTranscoder<LegacyDocument,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 Object |
deserialize(byte[] in) |
Class<LegacyDocument> |
documentType() |
protected LegacyDocument |
doDecode(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,Integer> |
doEncode(LegacyDocument document)
Perform the encoding of the request document.
|
static byte[] |
encodeNum(long l,
int maxBytes) |
LegacyDocument |
newDocument(String id,
int expiry,
Object content,
long cas) |
decode, encode, shouldAutoReleaseOnDecode, shouldAutoReleaseOnError
public static final int DEFAULT_COMPRESSION_THRESHOLD
public LegacyTranscoder()
public LegacyTranscoder(int compressionThreshold)
public Class<LegacyDocument> documentType()
protected LegacyDocument doDecode(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 Exception
AbstractTranscoder
Perform the decoding of the received response.
doDecode
in class AbstractTranscoder<LegacyDocument,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.Exception
- if something goes wrong during the decode process.public LegacyDocument newDocument(String id, int expiry, Object content, long cas)
protected com.couchbase.client.core.lang.Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> doEncode(LegacyDocument document) throws Exception
AbstractTranscoder
Perform the encoding of the request document.
doEncode
in class AbstractTranscoder<LegacyDocument,Object>
document
- the document to encode.Exception
- if something goes wrong during the encode process.public static byte[] encodeNum(long l, int maxBytes)
public static long decodeLong(byte[] b)
protected Object deserialize(byte[] in)
protected byte[] compress(byte[] in)
protected byte[] decompress(byte[] in)
Copyright © 2014 Couchbase, Inc.