本文整理汇总了Java中com.sleepycat.bind.tuple.TupleOutput.writeLong方法的典型用法代码示例。如果您正苦于以下问题:Java TupleOutput.writeLong方法的具体用法?Java TupleOutput.writeLong怎么用?Java TupleOutput.writeLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.bind.tuple.TupleOutput
的用法示例。
在下文中一共展示了TupleOutput.writeLong方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void add(EnQuad enQuad) {
DatabaseEntry key = new DatabaseEntry();
LongBinding.longToEntry(enQuad.time(), key);
w.reportLatestTime(enQuad.time());
TupleOutput out = new TupleOutput();
if(quad.getGraph().isVariable()) {
out.writeLong(enQuad.getGID());
}
if(quad.getSubject().isVariable()) {
out.writeLong(enQuad.getSID());
}
if(quad.getPredicate().isVariable()) {
out.writeLong(enQuad.getPID());
}
if(quad.getObject().isVariable()) {
out.writeLong(enQuad.getOID());
}
buff.put(null, key, new DatabaseEntry(out.getBufferBytes()));
}
示例2: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public boolean createSecondaryKey(SecondaryDatabase secondary,
DatabaseEntry key, DatabaseEntry data, DatabaseEntry result) {
TupleInput dataInput = new TupleInput(data.getData());
TupleOutput indexKeyOutput = new TupleOutput();
int p = idxList.size() - 1;
//System.out.println("key lenght"+idxList.size());
for(int l = 0; l < size && p >= 0; l++) {
long tmp = dataInput.readLong();
//while(p>=0)
if(l == idxList.get(p)) {
// System.out.print("key "+l+" = "+tmp +" ");
indexKeyOutput.writeLong(tmp);
p--;
}
}
//System.out.println("");
result.setData(indexKeyOutput.getBufferBytes());
return true;
}
示例3: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
/**
* @param secondary
* @param key
* @param data
* @param result
*/
public boolean createSecondaryKey(SecondaryDatabase secondary,
DatabaseEntry key, DatabaseEntry data, DatabaseEntry result) {
TupleInput dataInput = new TupleInput(data.getData());
TupleOutput indexKeyOutput = new TupleOutput();
int p = idxList.size() - 1;
for(int l = 0; l < size && p >= 0; l++) {
long tmp = dataInput.readLong();
if(l == idxList.get(p)) {
indexKeyOutput.writeLong(tmp);
p--;
}
}
result.setData(indexKeyOutput.getBufferBytes());
return true;
}
示例4: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void objectToEntry(Beacon beacon, TupleOutput to) {
to.writeString(beacon.getScannerID());
to.writeString(beacon.getUUID());
to.writeInt(beacon.getCode());
to.writeInt(beacon.getManufacturer());
to.writeInt(beacon.getMajor());
to.writeInt(beacon.getMinor());
to.writeInt(beacon.getPower());
to.writeInt(beacon.getPower());
to.writeInt(beacon.getRssi());
to.writeLong(beacon.getTime());
to.writeInt(beacon.getMessageType());
}
示例5: doDocumentToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private static void doDocumentToEntry(final Document document, final TupleOutput to) {
to.writeString(CURRENT_VERSION);
doDocumentVersionToEntry(document.getDocumentVersion(), to);
to.writeLong(document.getSize());
to.writeString(document.getName());
to.writeString(document.getContent());
to.writeString(document.getType());
//Assertion.invariant(!document.getExtractedMetaDataContainer().getMetaDataSet().isEmpty(), "WRITING: Les donn�es extraitent sont vide");
doMdcToEntry(document.getExtractedMetaDataContainer(), to);
doMdcToEntry(document.getEnhancedMetaDataContainer(), to);
doMdcToEntry(document.getUserDefinedMetaDataContainer(), to);
}
示例6: doMdcToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private static void doMdcToEntry(final MetaDataContainer metaDataContainer, final TupleOutput to) {
to.writeInt(metaDataContainer.getMetaDataSet().size());
for (final MetaData metaData : metaDataContainer.getMetaDataSet()) {
Assertion.checkArgument(metaData instanceof Enum, "Les MetaData doivent �tre des enums pour �tre serializable !! {0} est une {1}", metaData, metaData.getClass().getName());
//-----------------------------------------------------------------
to.writeString(metaData.getClass().getName());
to.writeString(metaData.toString());//TODO :WARN ne marche que parceque ce sont des enums !!
final Object value = metaDataContainer.getValue(metaData);
to.writeBoolean(value != null);
if (value != null) {
switch (metaData.getType()) {
case DATE:
to.writeLong(((Date) value).getTime());
break;
case INTEGER:
to.writeInt((Integer) value);
break;
case LONG:
to.writeLong((Long) value);
break;
case STRING:
to.writeString((String) value);
break;
default:
throw new IllegalStateException();
}
}
}
}
示例7: writeValue
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private static void writeValue(final TupleOutput to, final Object value) {
if (value == null) {
to.writeString("NULL");
} else if (value instanceof Float) {
to.writeString("F");
to.writeFloat(Float.class.cast(value));
} else if (value instanceof Long) {
to.writeString("L");
to.writeLong(Long.class.cast(value));
} else if (value instanceof Integer) {
to.writeString("I");
to.writeInt(Integer.class.cast(value));
} else if (value instanceof Double) {
to.writeString("D");
to.writeDouble(Double.class.cast(value));
} else if (value instanceof String) {
to.writeString("S");
to.writeString(String.class.cast(value));
} else if (value instanceof Set) {
to.writeString("*");
to.writeInt(Set.class.cast(value).size());
for (final Object item : Set.class.cast(value)) {
writeValue(to, item);
}
} else {
throw new IllegalArgumentException(" type " + value.getClass() + " non reconnu");
}
}
示例8: 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);
}
示例9: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
@Override
public void objectToEntry(RepGroupImpl group, TupleOutput output) {
output.writeString(group.getName());
output.writeLong(group.getUUID().getMostSignificantBits());
output.writeLong(group.getUUID().getLeastSignificantBits());
output.writeInt(group.getVersion());
output.writeInt(group.getChangeVersion());
output.writeInt(group.getNodeIdSequence());
}
示例10: putRawBeacon
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
void putRawBeacon(byte[] beacon) throws IOException {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(beacon));
int version = dis.readInt();
int length = dis.readInt();
byte[] tmp = new byte[length];
dis.readFully(tmp);
String scannerID = new String(tmp);
length = dis.readInt();
tmp = new byte[length];
dis.readFully(tmp);
String uuid = new String(tmp);
int code = dis.readInt();
int manufacturer = dis.readInt();
int major = dis.readInt();
int minor = dis.readInt();
int power = dis.readInt();
int calibratedPower = dis.readInt();
int rssi = dis.readInt();
long time = dis.readLong();
int messageType = dis.readInt();
DatabaseEntry theKey = new DatabaseEntry();
TupleOutput keyOut = new TupleOutput();
keyOut.writeLong(time);
keyOut.writeInt(minor);
theKey.setData(keyOut.getBufferBytes());
DatabaseEntry theData = new DatabaseEntry();
TupleOutput dos = new TupleOutput();
dos.writeString(scannerID);
dos.writeString(uuid);
dos.writeInt(code);
dos.writeInt(manufacturer);
dos.writeInt(major);
dos.writeInt(minor);
dos.writeInt(power);
dos.writeInt(calibratedPower);
dos.writeInt(rssi);
dos.writeLong(time);
dos.writeInt(messageType);
theData.setData(dos.getBufferBytes());
// Put it in the database. These puts are transactionally protected
// (we're using autocommit).
OperationStatus status = beaconEventsDB.put(null, theKey, theData);
if(status != OperationStatus.SUCCESS) {
throw new DuplicateDataException(String.format("Failed to insert beacon[%d,%d]", time, minor));
}
// System.out.printf("Wrote beacon: [%s,%d,%d]time(%d)=%s,rssi=%d\n", uuid, major, minor, time, new Date(time), rssi);
}
示例11: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
@Override
public void objectToEntry(Beacon object, TupleOutput output) {
output.writeLong(object.getTime());
output.writeInt(object.getMinor());
}
示例12: doDocumentVersionToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private static void doDocumentVersionToEntry(final DocumentVersion documentVersion, final TupleOutput to) {
to.writeString(documentVersion.getUrl());
to.writeString(documentVersion.getDataSourceId());
to.writeLong(documentVersion.getLastModified().getTime());
}
示例13: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
@Override
public void objectToEntry(LogChangeSet changeSet,
TupleOutput output) {
output.writeLong(changeSet.getNextSyncStart());
output.writeLong(changeSet.getLastSyncEnd());
}