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,
ResponseStatus status)
Perform the decoding of the received response.
|
protected 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)
Creates a new Document with the passed in information.
|
LegacyDocument |
newDocument(String id,
int expiry,
Object content,
long cas,
MutationToken mutationToken)
Default implementation for backwards compatibility.
|
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, 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)
Transcoder
Creates a new Document with the passed in information.
Use the one with the mutation token instead (Transcoder.newDocument(String, int, Object, long, MutationToken)
).
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.public LegacyDocument newDocument(String id, int expiry, Object content, long cas, MutationToken mutationToken)
AbstractTranscoder
Default implementation for backwards compatibility.
newDocument
in interface Transcoder<LegacyDocument,Object>
newDocument
in class AbstractTranscoder<LegacyDocument,Object>
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.mutationToken
- the documents mutation token.protected 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 © 2015 Couchbase, Inc.