Search in sources :

Example 1 with CompositeReadableBuffer

use of org.apache.qpid.proton.codec.CompositeReadableBuffer in project vertx-proton by vert-x3.

the class ProtonReceiverImpl method handlePartial.

private void handlePartial(final Receiver receiver, final Delivery delivery) {
    if (sessionIncomingCapacity <= 0 || maxFrameSize <= 0 || session.getIncomingBytes() < windowFullThreshhold) {
    // No window, or there is still capacity, so do nothing.
    } else {
        // room made for receiving more of the delivery.
        if (delivery.available() > 0) {
            ReadableBuffer buff = receiver.recv();
            if (splitContent == null && buff instanceof CompositeReadableBuffer) {
                // Its a composite and there is no prior partial content, use it.
                splitContent = (CompositeReadableBuffer) buff;
            } else {
                int remaining = buff.remaining();
                if (remaining > 0) {
                    if (splitContent == null) {
                        splitContent = new CompositeReadableBuffer();
                    }
                    byte[] chunk = new byte[remaining];
                    buff.get(chunk);
                    splitContent.append(chunk);
                }
            }
        }
    }
}
Also used : CompositeReadableBuffer(org.apache.qpid.proton.codec.CompositeReadableBuffer) CompositeReadableBuffer(org.apache.qpid.proton.codec.CompositeReadableBuffer) ReadableBuffer(org.apache.qpid.proton.codec.ReadableBuffer)

Aggregations

CompositeReadableBuffer (org.apache.qpid.proton.codec.CompositeReadableBuffer)1 ReadableBuffer (org.apache.qpid.proton.codec.ReadableBuffer)1