Class BinaryTranscoder
- java.lang.Object
-
- com.couchbase.client.java.transcoder.AbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>
-
- com.couchbase.client.java.transcoder.BinaryTranscoder
-
- All Implemented Interfaces:
Transcoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>
public class BinaryTranscoder extends AbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>
-
-
Constructor Summary
Constructors Constructor Description BinaryTranscoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<BinaryDocument>documentType()protected BinaryDocumentdoDecode(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(BinaryDocument document)Perform the encoding of the request document.BinaryDocumentnewDocument(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)Creates a new Document with the passed in information.BinaryDocumentnewDocument(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, MutationToken mutationToken)Default implementation for backwards compatibility.protected booleanshouldAutoReleaseOnDecode()Flag method to auto release decoded buffers.protected booleanshouldAutoReleaseOnError()Flag method to auto release buffers on decoding error.-
Methods inherited from class com.couchbase.client.java.transcoder.AbstractTranscoder
decode, encode
-
-
-
-
Method Detail
-
doDecode
protected BinaryDocument doDecode(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, ResponseStatus status) throws Exception
Description copied from class:AbstractTranscoderPerform the decoding of the received response.- Specified by:
doDecodein classAbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Parameters:
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.- Returns:
- the decoded document.
- Throws:
Exception- if something goes wrong during the decode process.
-
doEncode
protected Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> doEncode(BinaryDocument document) throws Exception
Description copied from class:AbstractTranscoderPerform the encoding of the request document.- Specified by:
doEncodein classAbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Parameters:
document- the document to encode.- Returns:
- A tuple consisting of the encoded content and the flags to set.
- Throws:
Exception- if something goes wrong during the encode process.
-
newDocument
public BinaryDocument newDocument(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)
Description copied from interface:TranscoderCreates a new Document with the passed in information. Use the one with the mutation token instead (Transcoder.newDocument(String, int, Object, long, MutationToken)).- Parameters:
id- the id of the document.expiry- the document expiration.content- the document content.cas- the documents cas value.- Returns:
- the created document.
-
newDocument
public BinaryDocument newDocument(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, MutationToken mutationToken)
Description copied from class:AbstractTranscoderDefault implementation for backwards compatibility.- Specified by:
newDocumentin interfaceTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Overrides:
newDocumentin classAbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Parameters:
id- the id of the document.expiry- the document expiration.content- the document content.cas- the documents cas value.mutationToken- the documents mutation token.- Returns:
- the created document.
-
documentType
public Class<BinaryDocument> documentType()
-
shouldAutoReleaseOnDecode
protected boolean shouldAutoReleaseOnDecode()
Description copied from class:AbstractTranscoderFlag method to auto release decoded buffers. Override to change default behaviour (true).- Overrides:
shouldAutoReleaseOnDecodein classAbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Returns:
- true if the
ByteBufpassed todecodemethod is to be released automatically on success (default behaviour)
-
shouldAutoReleaseOnError
protected boolean shouldAutoReleaseOnError()
Description copied from class:AbstractTranscoderFlag method to auto release buffers on decoding error. Override to change default behaviour (true).- Overrides:
shouldAutoReleaseOnErrorin classAbstractTranscoder<BinaryDocument,com.couchbase.client.deps.io.netty.buffer.ByteBuf>- Returns:
- true if the
ByteBufpassed todecodemethod is to be released automatically in case of error (default behaviour)
-
-