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 { // The session window could be effectively full, we need to // read part of the delivery content to ensure there is // 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); } } } } }