本文整理汇总了Java中com.sleepycat.bind.tuple.TupleOutput.getBufferBytes方法的典型用法代码示例。如果您正苦于以下问题:Java TupleOutput.getBufferBytes方法的具体用法?Java TupleOutput.getBufferBytes怎么用?Java TupleOutput.getBufferBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.bind.tuple.TupleOutput
的用法示例。
在下文中一共展示了TupleOutput.getBufferBytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: objectToHex
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
/**
* Serializes an object by converting its TupleBinding byte based
* representation into the hex characters deonoting the bytes.
*
* @param <T> the type of the object being serialized
* @param binding the tuble binding used to convert it into its byte form
* @param object the object being serialized
* @return the hex string containing the serialized hex form of the object
*/
static <T> String objectToHex(TupleBinding<T> binding, T object) {
StringBuilder buffer = new StringBuilder();
TupleOutput tuple = new TupleOutput(new byte[100]);
binding.objectToEntry(object, tuple);
byte[] bytes = tuple.getBufferBytes();
int size = tuple.getBufferLength();
for (int i=0; i < size; i++) {
int lowNibble = (bytes[i] & 0xf);
int highNibble = ((bytes[i]>>4) & 0xf);
buffer.append(Character.forDigit(lowNibble,16));
buffer.append(Character.forDigit(highNibble,16));
}
return buffer.toString();
}
示例2: addBinding2Cache
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private void addBinding2Cache(Binding binding) {
//System.out.println(binding);
TupleOutput output = new TupleOutput();
for(int i = 0; i < vars.size(); i++) {
output.writeLong(context.engine().encode(binding.get(vars.get(i))));
}
DatabaseEntry tmp = new DatabaseEntry(output.getBufferBytes());
mainDB.put(null, tmp, tmp);
}
示例3: getTupleOutput
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public TupleOutput getTupleOutput(Object object) {
TupleOutput out = super.getTupleOutput(object);
bufSize = out.getBufferBytes().length;
return out;
}
示例4: serializeBytes
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
/**
* Serialize the node into its byte representation.
*
* @param node the node to be serialized
*
* @return the serailized byte array
*/
static public byte[] serializeBytes(RepNodeImpl node) {
final NodeBinding binding = new NodeBinding();
TupleOutput tuple = new TupleOutput(new byte[100]);
binding.objectToEntry(node, tuple);
return tuple.getBufferBytes();
}