@Override public void clear() { buffer.clear(); }
@Override public ByteBuf clear() { buf.clear(); return this; }
@Override public final ByteBuf clear() { buf.clear(); return this; }
@Override public final ByteBuf clear() { buf.clear(); return this; }
@Override public ByteBuf clear() { buf.clear(); return this; }
@Override public void handlerAdded(ChannelHandlerContext ctx) { this.ctx = ctx; // Ensure we use a heap based ByteBuf. buffer = Unpooled.wrappedBuffer(new byte[blockSize]); buffer.clear(); }
@Override public ByteBuf clear() { buf.clear(); return this; }
@Override public final ByteBuf clear() { buf.clear(); return this; }
@Override public void clear() { buffer.clear(); }
@Override public final ByteBuf clear() { byteBuf.clear(); return this; }
@Override public void handlerAdded(ChannelHandlerContext ctx) { this.ctx = ctx; // Ensure we use a heap based ByteBuf. buffer = Unpooled.wrappedBuffer(new byte[blockSize]); buffer.clear(); }
@Override public void handlerAdded(ChannelHandlerContext ctx) { this.ctx = ctx; // Ensure we use a heap based ByteBuf. buffer = Unpooled.wrappedBuffer(new byte[blockSize]); buffer.clear(); }
@Override public ByteBuf buffer() { buf.clear(); return buf; }
private void writeToChannel() throws IOException { if (closed) { throw new IOException("Already closed: " + id); } takeWriteResources(1); chc.writeAndFlush(buf.copy()).addListener(writeListener); buf.clear(); }
private void writeToChannel() throws IOException { if (closed) { throw new IOException("Already closed: " + id); } // Wait if we have exceeded our max pending write count waitForWritesToFinish(maxPendingWrites - 1); pendingWrites++; chc.writeAndFlush(buf.copy()).addListener(writeListener); buf.clear(); }
private void resetInternals() { rsm.reset(); if (buffer.refCnt() > 0) { buffer.clear(); } }
@Override public void clear() { changed(); buffer.clear(); buffer.setIndex(limit, limit); }
private static long transferWithCopy(MultipartBody multipartBody, int bufferSize) throws IOException { long transferred = 0; final ByteBuf buffer = Unpooled.buffer(bufferSize); try { while (multipartBody.transferTo(buffer) != BodyState.STOP) { transferred += buffer.readableBytes(); buffer.clear(); } return transferred; } finally { buffer.release(); } }
out.setIntLE(idx + CHECKSUM_OFFSET, check); out.writerIndex(idx + HEADER_LENGTH + compressedLength); buffer.clear();
@Test public void testSingleRead() throws IOException { final int srcArraySize = chunkSize - 1; final byte[] srcArray = new byte[srcArraySize]; random.nextBytes(srcArray); final ByteArrayBodyGenerator babGen = new ByteArrayBodyGenerator(srcArray); final Body body = babGen.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); try { // should take 1 read to get through the srcArray body.transferTo(chunkBuffer); assertEquals(chunkBuffer.readableBytes(), srcArraySize, "bytes read"); chunkBuffer.clear(); assertEquals(body.transferTo(chunkBuffer), BodyState.STOP, "body at EOF"); } finally { chunkBuffer.release(); } }