int capacity = _underlyingInput.capacity();
if (capacity == Transport.END_OF_STREAM) {
_tail_closed = true;
if (_decodedInputBuffer.position() > 0) {
throw new TransportException("bytes left unconsumed");
}
} else {
ByteBuffer tail = _underlyingInput.tail();
_decodedInputBuffer.flip();
tail.put(_decodedInputBuffer);