コード例 #1
0
ファイル: ChannelBuffers.cs プロジェクト: zhj149/dubbo.net
        public static IChannelBuffer DirectBuffer(int capacity)
        {
            if (capacity == 0)
            {
                return(EmptyBuffer);
            }

            IChannelBuffer buffer = new ByteBufferBackedChannelBuffer(
                Unpooled.Buffer(capacity));

            buffer.Clear();
            return(buffer);
        }
コード例 #2
0
        public override void SetBytes(int index, IChannelBuffer src, int srcIndex, int length)
        {
            if (src is ByteBufferBackedChannelBuffer)
            {
                ByteBufferBackedChannelBuffer bbsrc = (ByteBufferBackedChannelBuffer)src;
                IByteBuffer data = bbsrc.Buffer.Duplicate();

                data.Slice(srcIndex, length);
                SetBytes(index, data);
            }
            else if (Buffer.HasArray)
            {
                src.GetBytes(srcIndex, Buffer.Array, index + Buffer.ArrayOffset, length);
            }
            else
            {
                src.GetBytes(srcIndex, this, index, length);
            }
        }
コード例 #3
0
 public ByteBufferBackedChannelBuffer(ByteBufferBackedChannelBuffer buffer)
 {
     Buffer = buffer.Buffer;
     SetIndex(buffer.ReaderIndex, buffer.WriterIndex);
 }