/* Copyright 2010-2016 MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace MongoDB.Bson.IO { /// /// Represents a BSON reader. /// public interface IBsonReader : IDisposable { // properties /// /// Gets the current BsonType. /// BsonType CurrentBsonType { get; } /// /// Gets the current state of the reader. /// BsonReaderState State { get; } // methods /// /// Closes the reader. /// void Close(); /// /// Gets a bookmark to the reader's current position and state. /// /// A bookmark. BsonReaderBookmark GetBookmark(); /// /// Gets the current BsonType (calls ReadBsonType if necessary). /// /// The current BsonType. BsonType GetCurrentBsonType(); /// /// Determines whether this reader is at end of file. /// /// /// Whether this reader is at end of file. /// bool IsAtEndOfFile(); /// /// Reads BSON binary data from the reader. /// /// A BsonBinaryData. BsonBinaryData ReadBinaryData(); /// /// Reads a BSON boolean from the reader. /// /// A Boolean. bool ReadBoolean(); /// /// Reads a BsonType from the reader. /// /// A BsonType. BsonType ReadBsonType(); /// /// Reads BSON binary data from the reader. /// /// A byte array. byte[] ReadBytes(); /// /// Reads a BSON DateTime from the reader. /// /// The number of milliseconds since the Unix epoch. long ReadDateTime(); /// /// Reads a BSON Decimal128 from the reader. /// /// A . Decimal128 ReadDecimal128(); /// /// Reads a BSON Double from the reader. /// /// A Double. double ReadDouble(); /// /// Reads the end of a BSON array from the reader. /// void ReadEndArray(); /// /// Reads the end of a BSON document from the reader. /// void ReadEndDocument(); /// /// Reads a BSON Int32 from the reader. /// /// An Int32. int ReadInt32(); /// /// Reads a BSON Int64 from the reader. /// /// An Int64. long ReadInt64(); /// /// Reads a BSON JavaScript from the reader. /// /// A string. string ReadJavaScript(); /// /// Reads a BSON JavaScript with scope from the reader (call ReadStartDocument next to read the scope). /// /// A string. string ReadJavaScriptWithScope(); /// /// Reads a BSON MaxKey from the reader. /// void ReadMaxKey(); /// /// Reads a BSON MinKey from the reader. /// void ReadMinKey(); /// /// Reads the name of an element from the reader (using the provided name decoder). /// /// The name decoder. /// /// The name of the element. /// string ReadName(INameDecoder nameDecoder); /// /// Reads a BSON null from the reader. /// void ReadNull(); /// /// Reads a BSON ObjectId from the reader. /// /// An ObjectId. ObjectId ReadObjectId(); /// /// Reads a raw BSON array. /// /// The raw BSON array. IByteBuffer ReadRawBsonArray(); /// /// Reads a raw BSON document. /// /// The raw BSON document. IByteBuffer ReadRawBsonDocument(); /// /// Reads a BSON regular expression from the reader. /// /// A BsonRegularExpression. BsonRegularExpression ReadRegularExpression(); /// /// Reads the start of a BSON array. /// void ReadStartArray(); /// /// Reads the start of a BSON document. /// void ReadStartDocument(); /// /// Reads a BSON string from the reader. /// /// A String. string ReadString(); /// /// Reads a BSON symbol from the reader. /// /// A string. string ReadSymbol(); /// /// Reads a BSON timestamp from the reader. /// /// The combined timestamp/increment. long ReadTimestamp(); /// /// Reads a BSON undefined from the reader. /// void ReadUndefined(); /// /// Returns the reader to previously bookmarked position and state. /// /// The bookmark. void ReturnToBookmark(BsonReaderBookmark bookmark); /// /// Skips the name (reader must be positioned on a name). /// void SkipName(); /// /// Skips the value (reader must be positioned on a value). /// void SkipValue(); } }