Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of a <see cref="StreamObjectReader"/>.
        /// </summary>
        /// <param name="stream">The stream to read objects from.</param>
        /// <param name="knownObjects">An optional list of objects assumed known by the corresponding <see cref="StreamObjectWriter"/>.</param>
        /// <param name="binder">A binder that provides object and type decoding.</param>
        /// <param name="cancellationToken"></param>
        public StreamObjectReader(
            Stream stream,
            ObjectData knownObjects             = null,
            ObjectBinder binder                 = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            // String serialization assumes both reader and writer to be of the same endianness.
            // It can be adjusted for BigEndian if needed.
            Debug.Assert(BitConverter.IsLittleEndian);

            _reader            = new BinaryReader(stream, Encoding.UTF8);
            _referenceMap      = new ReferenceMap(knownObjects);
            _binder            = binder ?? FixedObjectBinder.Empty;
            _cancellationToken = cancellationToken;
            _valueStack        = SOW.s_variantStackPool.Allocate();
            _constructionStack = s_constructionStackPool.Allocate();
            _memberList        = SOW.s_variantListPool.Allocate();
            _memberReader      = new VariantListReader(_memberList);
        }
Exemplo n.º 2
0
 public static StringTable GetInstance()
 {
     return(s_staticPool.Allocate());
 }
 public ReaderReferenceMap()
 {
     _values = s_objectListPool.Allocate();
 }
Exemplo n.º 4
0
 public static TextKeyedCache <T> GetInstance()
 {
     return(s_staticPool.Allocate());
 }
Exemplo n.º 5
0
 public static BlobBuildingStream GetInstance()
 {
     return(s_pool.Allocate());
 }
Exemplo n.º 6
0
 public ReferenceMap(ObjectData baseData)
 {
     _baseData      = baseData;
     _baseDataCount = baseData != null ? _baseData.Objects.Length : 0;
     _values        = s_objectListPool.Allocate();
 }