Java Code Examples for com.sleepycat.bind.tuple.TupleOutput#writeInt()

The following examples show how to use com.sleepycat.bind.tuple.TupleOutput#writeInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
private void writeRecords(NewRecordImpl[] records, TupleOutput output)
{
    if (records == null)
    {
        output.writeInt(0);
    }
    else
    {
        output.writeInt(records.length);
        for (NewRecordImpl record : records)
        {
            UUID id = record.getId();
            output.writeLong(id.getMostSignificantBits());
            output.writeLong(id.getLeastSignificantBits());
            output.writeLong(record.getMessageNumber());
        }
    }
}
 
Example 2
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
private void writeRecords(OldRecordImpl[] records, TupleOutput output)
{
    if (records == null)
    {
        output.writeInt(0);
    }
    else
    {
        output.writeInt(records.length);
        for (OldRecordImpl record : records)
        {
            output.writeString(record.getQueueName());
            output.writeLong(record.getMessageNumber());
        }
    }
}
 
Example 3
Source File: PreparedTransactionBinding.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
private static void writeRecords(Transaction.EnqueueRecord[] records, TupleOutput output)
{
    if(records == null)
    {
        output.writeInt(0);
    }
    else
    {
        output.writeInt(records.length);
        for(Transaction.EnqueueRecord record : records)
        {
            UUID id = record.getResource().getId();
            output.writeLong(id.getMostSignificantBits());
            output.writeLong(id.getLeastSignificantBits());
            output.writeLong(record.getMessage().getMessageNumber());
        }
    }
}
 
Example 4
Source File: PreparedTransactionBinding.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
private static void writeRecords(Transaction.DequeueRecord[] records, TupleOutput output)
{
    if(records == null)
    {
        output.writeInt(0);
    }
    else
    {
        output.writeInt(records.length);
        for(Transaction.DequeueRecord record : records)
        {
            UUID id = record.getEnqueueRecord().getQueueId();
            output.writeLong(id.getMostSignificantBits());
            output.writeLong(id.getLeastSignificantBits());
            output.writeLong(record.getEnqueueRecord().getMessageNumber());
        }
    }
}
 
Example 5
Source File: XidBinding.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
@Override
public void objectToEntry(Xid xid, TupleOutput output)
{
    output.writeLong(xid.getFormat());
    output.writeInt(xid.getGlobalId() == null ? 0 : xid.getGlobalId().length);
    if(xid.getGlobalId() != null)
    {
        output.write(xid.getGlobalId());
    }
    output.writeInt(xid.getBranchId() == null ? 0 : xid.getBranchId().length);
    if(xid.getBranchId() != null)
    {
        output.write(xid.getBranchId());
    }

}
 
Example 6
Source File: UpgradeFrom4To5.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void objectToEntry(final StorableMessageMetaData metaData, final TupleOutput output)
{
    final int bodySize = 1 + metaData.getStorableSize();
    byte[] underlying = new byte[bodySize];
    underlying[0] = (byte) metaData.getType().ordinal();
    QpidByteBuffer buf = QpidByteBuffer.wrap(underlying);
    buf.position(1);
    buf = buf.slice();

    metaData.writeToBuffer(buf);
    output.writeInt(bodySize);
    output.writeFast(underlying);
}
 
Example 7
Source File: UpgradeFrom4To5.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void objectToEntry(MessageContentKey object, TupleOutput tupleOutput)
{
    final MessageContentKey mk = object;
    tupleOutput.writeLong(mk.getMessageId());
    tupleOutput.writeInt(mk.getChunk());
}
 
Example 8
Source File: UpgradeFrom4To5.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void objectToEntry(ByteBuffer src, TupleOutput tupleOutput)
{
    src = src.slice();

    byte[] chunkData = new byte[src.limit()];
    src.duplicate().get(chunkData);

    tupleOutput.writeInt(chunkData.length);
    tupleOutput.writeFast(chunkData);
}
 
Example 9
Source File: StringMapBinding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void objectToEntry(final Map<String, String> stringStringMap, final TupleOutput tupleOutput)
{
    tupleOutput.writeInt(stringStringMap.size());
    for(Map.Entry<String,String> entry : stringStringMap.entrySet())
    {
        tupleOutput.writeString(entry.getKey());
        tupleOutput.writeString(entry.getValue());
    }
}
 
Example 10
Source File: IVFPQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (byte) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(int listId, byte[] code) {
	// write id, listId and code
	TupleOutput output = new TupleOutput();
	output.writeInt(listId);
	for (int i = 0; i < numSubVectors; i++) {
		output.writeByte(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToIvfpqDB.put(null, key, data);
}
 
Example 11
Source File: IVFPQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (short) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(int listId, short[] code) {
	// write id, listId and code
	TupleOutput output = new TupleOutput();
	output.writeInt(listId);
	for (int i = 0; i < numSubVectors; i++) {
		output.writeShort(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToIvfpqDB.put(null, key, data);
}
 
Example 12
Source File: LinkValueEntryBinding.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
private void write(final Object object, final TupleOutput output)
{
    byte[] bytes = LinkStoreUtils.objectToAmqpBytes(object);
    output.writeInt(bytes.length);
    output.write(bytes);
}
 
Example 13
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
@Override
public void objectToEntry(final CompoundKey object, final TupleOutput output)
{
    output.writeLong(object._messageId);
    output.writeInt(object._offset);
}
 
Example 14
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
@Override
public void objectToEntry(OldDataValue value, final TupleOutput output)
{
    output.writeInt(value.getSize());
    output.write(value.getData());
}