本文整理汇总了Java中com.sleepycat.bind.tuple.TupleOutput.writeFast方法的典型用法代码示例。如果您正苦于以下问题:Java TupleOutput.writeFast方法的具体用法?Java TupleOutput.writeFast怎么用?Java TupleOutput.writeFast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.bind.tuple.TupleOutput
的用法示例。
在下文中一共展示了TupleOutput.writeFast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void objectToEntry(HGPersistentHandle[] link, TupleOutput output) {
//HGPersistentHandle[] link = (HGPersistentHandle[])x;
byte[] buffer = new byte[link.length * handleSize];
for (int i = 0; i < link.length; i++) {
HGPersistentHandle handle = (HGPersistentHandle)link[i];
System.arraycopy(handle.toByteArray(), 0, buffer, i * handleSize, handleSize);
}
output.writeFast(buffer);
}
示例2: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void objectToEntry(HGPersistentHandle[] link, TupleOutput output)
{
byte [] buffer = new byte[link.length * handleSize];
for (int i = 0; i < link.length; i++)
{
HGPersistentHandle handle = (HGPersistentHandle)link[i];
System.arraycopy(handle.toByteArray(), 0,
buffer, i*handleSize,
handleSize);
}
output.writeFast(buffer);
}
示例3: doInserts
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void doInserts()
throws DatabaseException {
DatabaseEntry data = new DatabaseEntry(new byte[dataSize]);
DatabaseEntry key = new DatabaseEntry();
byte[] keyBuffer = new byte[keySize];
byte[] keyPadding = new byte[keySize - 4];
Transaction txn = null;
for (int i = 1; i <= records; i += 1) {
TupleOutput keyOutput = new TupleOutput(keyBuffer);
keyOutput.writeInt(i);
keyOutput.writeFast(keyPadding);
TupleBinding.outputToEntry(keyOutput, key);
if (isTransactional() && txn == null) {
txn = env.beginTransaction(null, null);
}
db.put(txn, key, data);
if (txn != null && i % insertsPerTxn == 0) {
txn.commit();
txn = null;
}
}
}