public class TranscoderUtils
extends java.lang.Object
Helper methods and flags for the shipped Transcoder
s.
Modifier and Type | Class and Description |
---|---|
static class |
TranscoderUtils.CommonFlags
The common flags enum.
|
Modifier and Type | Field and Description |
---|---|
static int |
BINARY_COMMON_FLAGS |
static int |
BINARY_COMPAT_FLAGS |
static int |
BOOLEAN_COMPAT_FLAGS |
static int |
DOUBLE_COMPAT_FLAGS |
static int |
JSON_COMMON_FLAGS |
static int |
JSON_COMPAT_FLAGS |
static int |
LONG_COMPAT_FLAGS |
static int |
PRIVATE_COMMON_FLAGS |
static int |
SERIALIZED_COMPAT_FLAGS |
static int |
STRING_COMMON_FLAGS |
static int |
STRING_COMPAT_FLAGS |
Constructor and Description |
---|
TranscoderUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
createCommonFlags(int flags)
Takes a integer representation of flags and moves them to the common flags MSBs.
|
static java.io.Serializable |
deserialize(com.couchbase.client.deps.io.netty.buffer.ByteBuf content)
Takes the input content and deserializes it.
|
static int |
extractCommonFlags(int flags)
Returns only the common flags from the full flags.
|
static boolean |
hasBinaryFlags(int flags)
Checks if the flags identify a binary document.
|
static boolean |
hasCommonFlags(int flags)
Checks whether the upper 8 bits are set, indicating common flags presence.
|
static boolean |
hasJsonFlags(int flags)
Checks if the flags identify a JSON document.
|
static boolean |
hasSerializableFlags(int flags)
Checks if the flags identify a serialized document.
|
static boolean |
hasStringFlags(int flags)
Checks if the flags identify a String document.
|
static com.couchbase.client.deps.io.netty.buffer.ByteBuf |
serialize(java.io.Serializable serializable)
Serializes the input into a ByteBuf.
|
public static final int PRIVATE_COMMON_FLAGS
public static final int JSON_COMMON_FLAGS
public static final int BINARY_COMMON_FLAGS
public static final int STRING_COMMON_FLAGS
public static final int SERIALIZED_COMPAT_FLAGS
public static final int JSON_COMPAT_FLAGS
public static final int BINARY_COMPAT_FLAGS
public static final int BOOLEAN_COMPAT_FLAGS
public static final int LONG_COMPAT_FLAGS
public static final int DOUBLE_COMPAT_FLAGS
public static final int STRING_COMPAT_FLAGS
public static boolean hasCommonFlags(int flags)
Checks whether the upper 8 bits are set, indicating common flags presence.
It does this by shifting bits to the right until only the most significant bits are remaining and then checks if one of them is set.
flags
- the flags to check.public static int extractCommonFlags(int flags)
Returns only the common flags from the full flags.
flags
- the flags to check.public static int createCommonFlags(int flags)
Takes a integer representation of flags and moves them to the common flags MSBs.
flags
- the flags to shift.public static boolean hasJsonFlags(int flags)
Checks if the flags identify a JSON document.
This method is strict if it finds common flags set, and if not falls back to a check of legacy JSON string (identified by 0 flags and no compression).
flags
- the flags to check.public static boolean hasStringFlags(int flags)
Checks if the flags identify a String document.
This method is strict if it finds common flags set, and if not falls back to a check of legacy String (identified by 0 flags and no compression).
flags
- the flags to check.public static boolean hasSerializableFlags(int flags)
Checks if the flags identify a serialized document.
flags
- the flags to check.public static boolean hasBinaryFlags(int flags)
Checks if the flags identify a binary document.
flags
- the flags to check.public static java.io.Serializable deserialize(com.couchbase.client.deps.io.netty.buffer.ByteBuf content) throws java.lang.Exception
Takes the input content and deserializes it.
content
- the content to deserialize.java.lang.Exception
- if something goes wrong during deserialization.public static com.couchbase.client.deps.io.netty.buffer.ByteBuf serialize(java.io.Serializable serializable) throws java.lang.Exception
Serializes the input into a ByteBuf.
serializable
- the object to serialize.java.lang.Exception
- if something goes wrong during serialization.