Example #1
0
        /// <inheritdoc/>
        public override void Encode(IoSession session, Object message, IProtocolEncoderOutput output)
        {
            String   value  = (String)message;
            IoBuffer buffer = IoBuffer.Allocate(value.Length);

            buffer.AutoExpand = true;
            buffer.PutPrefixedString(value, PrefixLength, Encoding);
            if (buffer.Position > MaxDataLength)
            {
                throw new ArgumentException("Data length: " + buffer.Position);
            }
            buffer.Flip();
            output.Write(buffer);
        }