@Test (expected = EncoderException.class) public void testAllocateDirectBufferExceedMaxEncodeSize() { final int maxEncodeSize = 1024; Lz4FrameEncoder encoder = newEncoder(Lz4Constants.DEFAULT_BLOCK_SIZE, maxEncodeSize); int inputBufferSize = maxEncodeSize * 10; ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(inputBufferSize, inputBufferSize); try { buf.writerIndex(inputBufferSize); encoder.allocateBuffer(ctx, buf, false); } finally { buf.release(); } }
@Override protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) { return allocateBuffer(ctx, msg, preferDirect, true); }
Lz4FrameEncoder extends MessageToByteEncoder<ByteBuf> { @Override protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) { return allocateBuffer(ctx, msg, preferDirect, true); } }
Lz4FrameEncoder extends MessageToByteEncoder<ByteBuf> { @Override protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) { return allocateBuffer(ctx, msg, preferDirect, true); } Lz4FrameEncoder();  Lz4FrameEncoder(boolean highCompressor);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize,
                           Checksum checksum, int maxEncodeSize); }
Lz4FrameEncoder extends MessageToByteEncoder<ByteBuf> { @Override protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) { return allocateBuffer(ctx, msg, preferDirect, true); } Lz4FrameEncoder();  Lz4FrameEncoder(boolean highCompressor);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize,
                           Checksum checksum, int maxEncodeSize); @Override void flush(final ChannelHandlerContext ctx); boolean isClosed(); ChannelFuture close(); ChannelFuture close(final ChannelPromise promise); @Override void close(final ChannelHandlerContext ctx, final ChannelPromise promise); @Override void handlerAdded(ChannelHandlerContext ctx); @Override void handlerRemoved(ChannelHandlerContext ctx); }
Lz4FrameEncoder extends MessageToByteEncoder<ByteBuf> { @Override protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) { return allocateBuffer(ctx, msg, preferDirect, true); } Lz4FrameEncoder();  Lz4FrameEncoder(boolean highCompressor);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum);  Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize,
                           Checksum checksum, int maxEncodeSize); @Override void flush(final ChannelHandlerContext ctx); boolean isClosed(); ChannelFuture close(); ChannelFuture close(final ChannelPromise promise); @Override void close(final ChannelHandlerContext ctx, final ChannelPromise promise); @Override void handlerAdded(ChannelHandlerContext ctx); @Override void handlerRemoved(ChannelHandlerContext ctx);  }