@InterfaceStability.Uncommitted @InterfaceAudience.Public public class ByteArrayTranscoder extends AbstractTranscoder<ByteArrayDocument,byte[]>
A transcoder to encode and decode ByteArrayDocument
s.
This transcoder makes it much easier to work with raw binary data than BinaryTranscoder
since on retry and unsubscribe, buffers don’t need to be freed and managed seperately. As a result, for all but special purpose cases it should be preferred over BinaryTranscoder
.
Constructor and Description |
---|
ByteArrayTranscoder() |
Modifier and Type | Method and Description |
---|---|
Class<ByteArrayDocument> |
documentType() |
protected ByteArrayDocument |
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(ByteArrayDocument document)
Perform the encoding of the request document.
|
ByteArrayDocument |
newDocument(String id,
int expiry,
byte[] content,
long cas)
Creates a new Document with the passed in information.
|
ByteArrayDocument |
newDocument(String id,
int expiry,
byte[] content,
long cas,
MutationToken mutationToken)
Default implementation for backwards compatibility.
|
decode, encode, shouldAutoReleaseOnDecode, shouldAutoReleaseOnError
protected ByteArrayDocument 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<ByteArrayDocument,byte[]>
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.protected Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> doEncode(ByteArrayDocument document) throws Exception
AbstractTranscoder
Perform the encoding of the request document.
doEncode
in class AbstractTranscoder<ByteArrayDocument,byte[]>
document
- the document to encode.Exception
- if something goes wrong during the encode process.public ByteArrayDocument newDocument(String id, int expiry, byte[] 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 ByteArrayDocument newDocument(String id, int expiry, byte[] content, long cas, MutationToken mutationToken)
AbstractTranscoder
Default implementation for backwards compatibility.
newDocument
in interface Transcoder<ByteArrayDocument,byte[]>
newDocument
in class AbstractTranscoder<ByteArrayDocument,byte[]>
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.mutationToken
- the documents mutation token.public Class<ByteArrayDocument> documentType()
Copyright © 2015 Couchbase, Inc.