public IChannelBuffer GetBuffer(IByteBuffer nioBuffer) { if (nioBuffer.HasArray) { return(ChannelBuffers.WrappedBuffer(nioBuffer)); } IChannelBuffer buf = GetBuffer((IByteBuffer)nioBuffer.Duplicate()); int pos = nioBuffer.ReaderIndex; buf.WriteBytes(nioBuffer); nioBuffer.SetReaderIndex(pos); return(buf); }
public IChannelBuffer GetBuffer(byte[] array, int offset, int length) { return(ChannelBuffers.WrappedBuffer(array, offset, length)); }