WriteString() public method

public WriteString ( String str ) : void
str String
return void
コード例 #1
0
ファイル: DeleteMessage.cs プロジェクト: ningliaoyuan/Antaeus
 protected override void WriteBody(BsonWriter writer)
 {
     writer.WriteValue(BsonDataType.Integer,0);
     writer.WriteString(this.FullCollectionName);
     writer.WriteValue(BsonDataType.Integer,0);
     writer.Write(this.Selector);
 }
コード例 #2
0
 protected override void WriteBody(BsonWriter writer)
 {
     writer.WriteValue(BsonDataType.Integer,0);
     writer.WriteString(this.FullCollectionName);
     writer.WriteValue(BsonDataType.Integer,this.NumberToReturn);
     writer.WriteValue(BsonDataType.Long,this.CursorID);
 }
コード例 #3
0
        public void TestWriteString()
        {
            MemoryStream ms       = new MemoryStream();
            BsonWriter   writer   = new BsonWriter(ms);
            string       expected = "54-65-73-74-73-2E-69-6E-73-65-72-74-73-00";

            writer.WriteString("Tests.inserts");

            string hexdump = BitConverter.ToString(ms.ToArray());

            Assert.AreEqual(expected, hexdump);
        }
コード例 #4
0
        /// <summary>
        /// Writes out a header and the chunk of documents.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="chunk"></param>
        protected void WriteChunk(Stream stream, MessageChunk chunk)
        {
            WriteHeader(new BinaryWriter(stream), chunk.Size);

            BsonWriter writer = new BsonWriter(stream);
            writer.WriteValue(BsonDataType.Integer,0);
            writer.WriteString(this.FullCollectionName);

            foreach(Document doc in chunk.Documents){
                writer.Write(doc);
            }
            writer.Flush();
        }
コード例 #5
0
        public void TestWriteString()
        {
            MemoryStream ms = new MemoryStream();
            BsonWriter writer = new BsonWriter(ms);
            string expected = "54-65-73-74-73-2E-69-6E-73-65-72-74-73-00";
            writer.WriteString("Tests.inserts");

            string hexdump = BitConverter.ToString(ms.ToArray());

            Assert.AreEqual(expected, hexdump);
        }
コード例 #6
0
ファイル: QueryMessage.cs プロジェクト: ningliaoyuan/Antaeus
 protected override void WriteBody(BsonWriter writer)
 {
     writer.WriteValue(BsonDataType.Integer,(int)this.Options);
     writer.WriteString(this.FullCollectionName);
     writer.WriteValue(BsonDataType.Integer,(int)this.NumberToSkip);
     writer.WriteValue(BsonDataType.Integer,(int)this.NumberToReturn);
     writer.Write(this.Query);
     if(this.ReturnFieldSelector != null){
         writer.Write(this.ReturnFieldSelector);
     }
 }
コード例 #7
0
ファイル: MsgMessage.cs プロジェクト: sdether/mongodb-csharp
 protected override void WriteBody(BsonWriter writer)
 {
     writer.WriteString(this.Message);
 }
コード例 #8
0
 private string WriteStringAndGetHex(string val)
 {
     MemoryStream ms = new MemoryStream();
     BsonWriter writer = new BsonWriter(ms);
     writer.WriteString(val);
     return BitConverter.ToString(ms.ToArray());
 }
コード例 #9
0
 private string WriteAndReadLenString(string val)
 {
     MemoryStream ms = new MemoryStream();
     BsonWriter bs = new BsonWriter(ms);
     BinaryWriter w = new BinaryWriter(ms);
     int byteCount = bs.CalculateSize(val,false);
     w.Write(byteCount);
     bs.WriteString(val);
     ms.Seek(0,SeekOrigin.Begin);
     BsonReader reader = new BsonReader(ms);
     return reader.ReadLenString();
 }