@Override public boolean release(int decrement) { return wrapped.release(decrement); }
@Override public boolean release() { return wrapped.release(); }
@Override public boolean release() { return wrapped.release(); }
@Override public boolean release(int decrement) { return wrapped.release(decrement); }
@Override public boolean release(int decrement) { return wrapped.release(decrement); }
@Override public boolean release() { return wrapped.release(); }
@Override protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first) { if (first instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) first; first = allocator.directBuffer(composite.readableBytes()); try { first.writeBytes(composite); } catch (Throwable cause) { first.release(); PlatformDependent.throwException(cause); } composite.release(); } return first; }
@Override public void call(CompositeByteBuf collector, ByteBuf buf) { long newLength = collector.readableBytes() + buf.readableBytes(); if (newLength <= maxBytes) { collector.addComponent(true, buf); } else { collector.release(); buf.release(); throw new TooMuchDataException("More than " + maxBytes + "B received"); } } }
@Override protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first) { if (first instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) first; first = allocator.directBuffer(composite.readableBytes()); try { first.writeBytes(composite); } catch (Throwable cause) { first.release(); PlatformDependent.throwException(cause); } composite.release(); } return first; }
private byte[] fetchDecoderOutput() { final CompositeByteBuf decoded = Unpooled.compositeBuffer(); for (;;) { final ByteBuf buf = decoder.readInbound(); if (buf == null) { break; } if (!buf.isReadable()) { buf.release(); continue; } decoded.addComponent(true, buf); } final byte[] ret = ByteBufUtil.getBytes(decoded); decoded.release(); return ret; } }
/** * Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}. */ protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { // Create a composite buffer to accumulate this pair and potentially all the buffers // in the queue. Using +2 as we have already dequeued current and next. CompositeByteBuf composite = alloc.compositeBuffer(size() + 2); try { composite.addComponent(true, cumulation); composite.addComponent(true, next); } catch (Throwable cause) { composite.release(); safeRelease(next); throwException(cause); } return composite; }
/** * Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}. */ protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { // Create a composite buffer to accumulate this pair and potentially all the buffers // in the queue. Using +2 as we have already dequeued current and next. CompositeByteBuf composite = alloc.compositeBuffer(size() + 2); try { composite.addComponent(true, cumulation); composite.addComponent(true, next); } catch (Throwable cause) { composite.release(); safeRelease(next); throwException(cause); } return composite; }
/** * Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}. */ protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { // Create a composite buffer to accumulate this pair and potentially all the buffers // in the queue. Using +2 as we have already dequeued current and next. CompositeByteBuf composite = alloc.compositeBuffer(size() + 2); try { composite.addComponent(true, cumulation); composite.addComponent(true, next); } catch (Throwable cause) { composite.release(); safeRelease(next); throwException(cause); } return composite; }
compositeUncompressedContent.release(); throw new CodecException("cannot read uncompressed buffer");
fullCompressedContent.release(); throw new CodecException("cannot read compressed buffer");
@Override public boolean release() { return wrapped.release(); }
@Override public boolean release(int decrement) { return wrapped.release(decrement); }
@Override protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first) { if (first instanceof CompositeByteBuf) { CompositeByteBuf composite = (CompositeByteBuf) first; first = allocator.directBuffer(composite.readableBytes()); try { first.writeBytes(composite); } catch (Throwable cause) { first.release(); PlatformDependent.throwException(cause); } composite.release(); } return first; }
private static byte[] decodeAndRelease(CompositeByteBuf aggregate) { try { return getBytes(aggregate); } finally { aggregate.release(); } }
@Override public void onError(Throwable cause) { aggregated.release(); subscription.cancel(); future.completeExceptionally(cause); }