use of com.aerospike.client.util.Packer in project aerospike-client-java by aerospike.
the class BitExp method packMath.
private static byte[] packMath(int command, BitPolicy policy, Exp bitOffset, Exp bitSize, Exp value, boolean signed, BitOverflowAction action) {
Packer packer = new Packer();
// Pack.init() only required when CTX is used and server does not support CTX for bit operations.
// Pack.init(packer, ctx);
packer.packArrayBegin(6);
packer.packInt(command);
bitOffset.pack(packer);
bitSize.pack(packer);
value.pack(packer);
packer.packInt(policy.flags);
int flags = action.flags;
if (signed) {
flags |= INT_FLAGS_SIGNED;
}
packer.packInt(flags);
return packer.toByteArray();
}
use of com.aerospike.client.util.Packer in project aerospike-client-java by aerospike.
the class ListExp method packRangeOperation.
protected static byte[] packRangeOperation(int command, int returnType, Exp begin, Exp end, CTX[] ctx) {
Packer packer = new Packer();
Pack.init(packer, ctx);
packer.packArrayBegin((end != null) ? 4 : 3);
packer.packInt(command);
packer.packInt(returnType);
if (begin != null) {
begin.pack(packer);
} else {
packer.packNil();
}
if (end != null) {
end.pack(packer);
}
return packer.toByteArray();
}
use of com.aerospike.client.util.Packer in project aerospike-client-java by aerospike.
the class BitOperation method packGetInt.
private static byte[] packGetInt(int bitOffset, int bitSize, boolean signed) {
Packer packer = new Packer();
// Pack.init() only required when CTX is used and server does not support CTX for bit operations.
// Pack.init(packer, ctx);
packer.packArrayBegin(signed ? 4 : 3);
packer.packInt(GET_INT);
packer.packInt(bitOffset);
packer.packInt(bitSize);
if (signed) {
packer.packInt(INT_FLAGS_SIGNED);
}
return packer.toByteArray();
}
use of com.aerospike.client.util.Packer in project aerospike-client-java by aerospike.
the class ListOperation method get.
/**
* Create list get operation.
* Server returns item at specified index in list bin.
*/
public static Operation get(String binName, int index) {
Packer packer = new Packer();
packer.packRawShort(GET);
packer.packArrayBegin(1);
packer.packInt(index);
byte[] bytes = packer.toByteArray();
return new Operation(Operation.Type.CDT_READ, binName, Value.get(bytes));
}
use of com.aerospike.client.util.Packer in project aerospike-client-java by aerospike.
the class MapBase method createOperation.
protected static Operation createOperation(int command, Operation.Type type, String binName, Value value, MapReturnType returnType) {
Packer packer = new Packer();
packer.packRawShort(command);
packer.packArrayBegin(2);
packer.packInt(returnType.type);
value.pack(packer);
return new Operation(type, binName, Value.get(packer.toByteArray()));
}