예제 #1
0
 public virtual MessageFlyweight Wrap(IClientProtocolBuffer buffer, int offset)
 {
     this.buffer = buffer;
     this.offset = offset;
     index       = 0;
     return(this);
 }
        public static ClientMessage CreateForEncode(IClientProtocolBuffer buffer, int offset)
        {
            var clientMessage = new ClientMessage();

            clientMessage.WrapForEncode(buffer, offset);
            return(clientMessage);
        }
 /// <summary>Append a source buffer to the end of the internal buffer, resizing the internal buffer as required.</summary>
 /// <param name="srcBuffer">from which to copy.</param>
 /// <param name="srcOffset">in the source buffer from which to copy.</param>
 /// <param name="length">in bytes to copy from the source buffer.</param>
 /// <returns>the builder for fluent API usage.</returns>
 public virtual BufferBuilder Append(IClientProtocolBuffer srcBuffer, int srcOffset, int length)
 {
     EnsureCapacity(length);
     srcBuffer.GetBytes(srcOffset, _protocolBuffer.ByteArray(), _position, length);
     _position += length;
     return this;
 }
예제 #4
0
 /// <summary>Append a source buffer to the end of the internal buffer, resizing the internal buffer as required.</summary>
 /// <param name="srcBuffer">from which to copy.</param>
 /// <param name="srcOffset">in the source buffer from which to copy.</param>
 /// <param name="length">in bytes to copy from the source buffer.</param>
 /// <returns>the builder for fluent API usage.</returns>
 public virtual BufferBuilder Append(IClientProtocolBuffer srcBuffer, int srcOffset, int length)
 {
     EnsureCapacity(length);
     srcBuffer.GetBytes(srcOffset, protocolBuffer.ByteArray(), position, length);
     position += length;
     return(this);
 }
 protected internal virtual void WrapForEncode(IClientProtocolBuffer buffer, int offset)
 {
     EnsureHeaderSize(offset, buffer.Capacity());
     Wrap(buffer, offset);
     SetDataOffset(HeaderSize);
     SetFrameLength(HeaderSize);
     Index(GetDataOffset());
     SetPartitionId(-1);
 }
 public virtual MessageFlyweight Wrap(IClientProtocolBuffer buffer, int offset)
 {
     Buffer = buffer;
     _offset = offset;
     _index = 0;
     return this;
 }
 protected internal virtual void WrapForDecode(IClientProtocolBuffer buffer, int offset)
 {
     EnsureHeaderSize(offset, buffer.Capacity());
     Wrap(buffer, offset);
     Index(GetDataOffset());
 }
예제 #8
0
        /// <summary>Construct a buffer builder with an initial capacity that will be rounded up to the nearest power of 2.</summary>
        /// <param name="initialCapacity">at which the capacity will start.</param>
        private BufferBuilder(int initialCapacity)
        {
            capacity = QuickMath.NextPowerOfTwo(initialCapacity);

            protocolBuffer = new SafeBuffer(new byte[capacity]);
        }
        /// <summary>Construct a buffer builder with an initial capacity that will be rounded up to the nearest power of 2.</summary>
        /// <param name="initialCapacity">at which the capacity will start.</param>
        private BufferBuilder(int initialCapacity)
        {
            _capacity = QuickMath.NextPowerOfTwo(initialCapacity);

            _protocolBuffer = new SafeBuffer(new byte[_capacity]);
        }
 protected internal virtual void WrapForEncode(IClientProtocolBuffer buffer, int offset)
 {
     EnsureHeaderSize(offset, buffer.Capacity());
     Wrap(buffer, offset);
     SetDataOffset(HeaderSize);
     SetFrameLength(HeaderSize);
     Index(GetDataOffset());
     SetPartitionId(-1);
 }
 protected internal virtual void WrapForDecode(IClientProtocolBuffer buffer, int offset)
 {
     EnsureHeaderSize(offset, buffer.Capacity());
     Wrap(buffer, offset);
     Index(GetDataOffset());
 }
 public static ClientMessage CreateForEncode(IClientProtocolBuffer buffer, int offset)
 {
     var clientMessage = new ClientMessage();
     clientMessage.WrapForEncode(buffer, offset);
     return clientMessage;
 }