当前位置: 首页>>代码示例>>Java>>正文


Java TupleOutput.getBufferBytes方法代码示例

本文整理汇总了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();
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:25,代码来源:RepGroupImpl.java

示例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);
}
 
开发者ID:KMax,项目名称:cqels,代码行数:10,代码来源:BDBGraphPatternRouter.java

示例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;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:6,代码来源:TupleBindingTest.java

示例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();
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:14,代码来源:RepGroupImpl.java


注:本文中的com.sleepycat.bind.tuple.TupleOutput.getBufferBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。