229230231232233234235236237238239
} ByteBuffer bb = link.peekLast(); if(len <= writable) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + len); bb.put(b, off, len); bb.position(pos); writable = bb.capacity() - bb.limit(); return;
230231232233234235236237238239240
ByteBuffer bb = link.peekLast(); if(len <= writable) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + len); bb.put(b, off, len); bb.position(pos); writable = bb.capacity() - bb.limit(); return; }
233234235236237238239240241242243
int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + len); bb.put(b, off, len); bb.position(pos); writable = bb.capacity() - bb.limit(); return; } if(writable > 0) { int pos = bb.position();
239240241242243244245246247248249
return; } if(writable > 0) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + writable); bb.put(b, off, writable); bb.position(pos); off += writable; len -= writable;
240241242243244245246247248249250
} if(writable > 0) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + writable); bb.put(b, off, writable); bb.position(pos); off += writable; len -= writable; writable = 0;
251252253254255256257258259260261
} int sz = Math.max(len, bufferSize); ByteBuffer nb = ByteBuffer.allocate(sz); nb.put(b, off, len); nb.limit(len); nb.position(0); link.addLast(nb); writable = sz - len; }
277278279280281282283284285286287
int rem = buf.remaining(); ByteBuffer bb = link.peekLast(); if(rem <= writable) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + rem); bb.put(buf); bb.position(pos); writable = bb.capacity() - bb.limit(); return;
278279280281282283284285286287288
ByteBuffer bb = link.peekLast(); if(rem <= writable) { int pos = bb.position(); bb.position(bb.limit()); bb.limit(bb.limit() + rem); bb.put(buf); bb.position(pos); writable = bb.capacity() - bb.limit(); return; }