@Override public final int numComponents() { return wrapped.numComponents(); }
@Override public final int numComponents() { return wrapped.numComponents(); }
@Override public final int numComponents() { return wrapped.numComponents(); }
@Override public ByteBuf next() { if (size != numComponents()) { throw new ConcurrentModificationException(); } if (!hasNext()) { throw new NoSuchElementException(); } try { return components[index++].slice(); } catch (IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
@Override public ByteBuf next() { if (size != numComponents()) { throw new ConcurrentModificationException(); } if (!hasNext()) { throw new NoSuchElementException(); } try { return components[index++].slice(); } catch (IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
@Override public void channelReadComplete(final ChannelHandlerContext ctx) throws Exception { if (bufs.numComponents() > 0) { ctx.fireChannelRead(bufs); bufs = ByteBufAllocator.DEFAULT.compositeBuffer(); } ctx.fireChannelReadComplete(); } }
@Override protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { final int wrapDataSize = SslHandler.this.wrapDataSize; if (cumulation instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) cumulation; int numComponents = composite.numComponents(); if (numComponents == 0 || !attemptCopyToCumulation(composite.internalComponent(numComponents - 1), next, wrapDataSize)) { composite.addComponent(true, next); } return composite; } return attemptCopyToCumulation(cumulation, next, wrapDataSize) ? cumulation : copyAndCompose(alloc, cumulation, next); }
@Override protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { final int wrapDataSize = SslHandler.this.wrapDataSize; if (cumulation instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) cumulation; int numComponents = composite.numComponents(); if (numComponents == 0 || !attemptCopyToCumulation(composite.internalComponent(numComponents - 1), next, wrapDataSize)) { composite.addComponent(true, next); } return composite; } return attemptCopyToCumulation(cumulation, next, wrapDataSize) ? cumulation : copyAndCompose(alloc, cumulation, next); }
final int numComponents = cbb.numComponents();
if (readable && compositeUncompressedContent.numComponents() <= 0) { compositeUncompressedContent.release(); throw new CodecException("cannot read uncompressed buffer");
/** * Consolidate the composed {@link ByteBuf}s */ public CompositeByteBuf consolidate() { ensureAccessible(); final int numComponents = numComponents(); if (numComponents <= 1) { return this; } final Component last = components.get(numComponents - 1); final int capacity = last.endOffset; final ByteBuf consolidated = allocBuffer(capacity); for (int i = 0; i < numComponents; i ++) { Component c = components.get(i); ByteBuf b = c.buf; consolidated.writeBytes(b); c.freeIfNecessary(); } components.clear(); components.add(new Component(consolidated)); updateComponentOffsets(0); return this; }
if (fullCompressedContent.numComponents() <= 0) { fullCompressedContent.release(); throw new CodecException("cannot read compressed buffer");
@Override public final int numComponents() { return wrapped.numComponents(); }
@Override public ByteBuf next() { if (size != numComponents()) { throw new ConcurrentModificationException(); } if (!hasNext()) { throw new NoSuchElementException(); } try { return components[index++].slice(); } catch (IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
@Override protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { final int wrapDataSize = SslHandler.this.wrapDataSize; if (cumulation instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) cumulation; int numComponents = composite.numComponents(); if (numComponents == 0 || !attemptCopyToCumulation(composite.internalComponent(numComponents - 1), next, wrapDataSize)) { composite.addComponent(true, next); } return composite; } return attemptCopyToCumulation(cumulation, next, wrapDataSize) ? cumulation : copyAndCompose(alloc, cumulation, next); }
protected void writeInContext() { CompositeByteBuf cbb = ByteBufAllocator.DEFAULT.compositeBuffer(); for (; ; ) { ByteBuf buf = writeQueue.poll(); if (buf == null) { break; } writeQueueSize.decrementAndGet(); cbb.addComponent(true, buf); if (cbb.numComponents() == cbb.maxNumComponents()) { netSocket.write(Buffer.buffer(cbb)); cbb = ByteBufAllocator.DEFAULT.compositeBuffer(); } } if (cbb.isReadable()) { netSocket.write(Buffer.buffer(cbb)); } } }
@Override public final int numComponents() { return wrapped.numComponents(); }
private void aggregateChunks(final ByteBuf newChunk) { chunk.addComponent(chunk.numComponents(), newChunk); // Update writer index, addComponent does not update it chunk.writerIndex(chunk.writerIndex() + newChunk.readableBytes()); }
private void aggregateChunks(final ByteBuf newChunk) { chunk.addComponent(chunk.numComponents(), newChunk); // Update writer index, addComponent does not update it chunk.writerIndex(chunk.writerIndex() + newChunk.readableBytes()); }
@Override protected Object decodeValue(Context context, Type type, Short typeLength, Integer typeModifier, ByteBuf buffer, Class<?> targetClass, Object targetContext) throws IOException { NestedArrayType atype = (NestedArrayType) type; CompositeByteBuf compBuf = (CompositeByteBuf)buffer; ByteBuf[] elementBufs = new ByteBuf[compBuf.numComponents()]; for (int c = 0; c < elementBufs.length; ++c) { elementBufs[c] = compBuf.component(c).retain(); } return new PGBuffersArray(context, atype, atype.getElementFormat(), elementBufs, atype.getDimensions()); }