Java Code Examples for com.sleepycat.bind.tuple.TupleInput#read()

The following examples show how to use com.sleepycat.bind.tuple.TupleInput#read() . 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: LinkValueEntryBinding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
private Object read(final TupleInput input)
{
    int size = input.readInt();
    byte[] bytes = new byte[size];
    input.read(bytes);

    return LinkStoreUtils.amqpBytesToObject(bytes);
}
 
Example 2
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public OldDataValue entryToObject(final TupleInput input)
{
    int size = input.readInt();
    byte[] data = new byte[size];
    input.read(data);
    return new OldDataValue(size, data);
}
 
Example 3
Source File: UpgradeFrom5To6.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] entryToObject(final TupleInput input)
{
    byte[] data = new byte[input.available()];
    input.read(data);
    return data;
}
 
Example 4
Source File: ByteBufferBinding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public QpidByteBuffer entryToObject(final TupleInput input)
{
    int available = input.available();
    QpidByteBuffer buf = QpidByteBuffer.allocateDirect(available);
    byte[] copyBuf = COPY_BUFFER.get();
    while(available > 0)
    {
        int read = input.read(copyBuf);
        buf.put(copyBuf,0,read);
        available = input.available();
    }
    buf.flip();
    return buf;
}
 
Example 5
Source File: ByteBufferBinding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public ByteBuffer readByteBuffer(final TupleInput input, int length)
{
    ByteBuffer buf = ByteBuffer.allocateDirect(length);
    byte[] copyBuf = COPY_BUFFER.get();
    while(length > 0)
    {
        int read = input.read(copyBuf, 0, Math.min(COPY_BUFFER_SIZE, length));
        buf.put(copyBuf,0,read);
        length -= read;
    }
    buf.flip();
    return buf;
}