use of org.jboss.netty.buffer.DynamicChannelBuffer in project MSEC by Tencent.
the class RequestDecoder method setAttachment.
private void setAttachment(ChannelHandlerContext ctx, Channel channel, ChannelBuffer cb, int lastReadIndex) {
cb.readerIndex(lastReadIndex);
if (!(cb instanceof DynamicChannelBuffer) || cb.writerIndex() > 102400) {
ChannelBuffer db = ChannelBuffers.dynamicBuffer(cb.readableBytes() * 2, channel.getConfig().getBufferFactory());
db.writeBytes(cb);
cb = db;
}
NettyCodecUtils.setAttachment(ctx, Constants.ATTACHMENT_BYTEBUFFER, cb);
}
use of org.jboss.netty.buffer.DynamicChannelBuffer in project MSEC by Tencent.
the class ResponseDecoder method setAttachment.
private void setAttachment(ChannelHandlerContext ctx, Channel channel, ChannelBuffer cb, int lastReadIndex) {
cb.readerIndex(lastReadIndex);
if (!(cb instanceof DynamicChannelBuffer) || cb.writerIndex() > 102400) {
ChannelBuffer db = ChannelBuffers.dynamicBuffer(cb.readableBytes() * 2, channel.getConfig().getBufferFactory());
db.writeBytes(cb);
cb = db;
}
NettyCodecUtils.setAttachment(ctx, Constants.ATTACHMENT_BYTEBUFFER, cb);
}
use of org.jboss.netty.buffer.DynamicChannelBuffer in project camel by apache.
the class NettyConverterTest method startUp.
@Before
public void startUp() {
byte[] bytes = PAYLOAD.getBytes();
buf = new DynamicChannelBuffer(bytes.length);
buf.writeBytes(bytes);
}
Aggregations