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

The following examples show how to use com.sleepycat.bind.tuple.TupleOutput#writeFast() . 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: 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 2
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 3
Source File: FieldTableEncoding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public  static void writeFieldTable(FieldTable fieldTable, TupleOutput tupleOutput)
{

    if (fieldTable == null)
    {
        tupleOutput.writeLong(0);
    }
    else
    {
        tupleOutput.writeLong(fieldTable.getEncodedSize());
        tupleOutput.writeFast(fieldTable.getDataAsBytes());
    }
}
 
Example 4
Source File: AMQShortStringEncoding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public  static void writeShortString(AMQShortString shortString, TupleOutput tupleOutput)
{

    if (shortString == null)
    {
        tupleOutput.writeShort(-1);
    }
    else
    {
        tupleOutput.writeShort(shortString.length());
        tupleOutput.writeFast(shortString.getBytes(), 0, shortString.length());
    }
}
 
Example 5
Source File: LinkBinding.java    From hypergraphdb with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: LinkBinding.java    From hypergraphdb with Apache License 2.0 5 votes vote down vote up
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);
}