Write() private method

private Write ( WriteBuffer buf ) : bool
buf WriteBuffer
return bool
Ejemplo n.º 1
0
        internal static PregeneratedMessage Generate(WriteBuffer buf, QueryMessage queryMessage, string query, int responseMessageCount = 2)
        {
            Debug.Assert(query != null && query.All(c => c < 128));
            queryMessage.Populate(query);
            var description = queryMessage.ToString();

            queryMessage.Write(buf, false, CancellationToken.None).Wait();
            var bytes = buf.GetContents();

            buf.Clear();
            return(new PregeneratedMessage(bytes, description, responseMessageCount));
        }
Ejemplo n.º 2
0
        static PregeneratedMessage BuildQuery(string query)
        {
            Contract.Requires(query != null && query.All(c => c < 128));

            var totalLen = 5 + query.Length;
            var ms = new MemoryStream(totalLen);
            _tempBuf.Underlying = ms;
            var simpleQuery = new QueryMessage(query);
            simpleQuery.Write(_tempBuf);
            _tempBuf.Flush();
            return new PregeneratedMessage(ms.ToArray(), simpleQuery.ToString());
        }
Ejemplo n.º 3
0
        static PregeneratedMessage BuildQuery(string query)
        {
            Contract.Requires(query != null && query.All(c => c < 128));

            var totalLen = 5 + query.Length;
            var ms       = new MemoryStream(totalLen);

            _tempBuf.Underlying = ms;
            _tempQuery.Populate(query);
            _tempQuery.Write(_tempBuf);
            _tempBuf.Flush();
            return(new PregeneratedMessage(ms.ToArray(), _tempQuery.ToString()));
        }