Dispose() public method

Dispose the BlobReader, releasing any Streams allocated.
public Dispose ( ) : void
return void
コード例 #1
0
        public object Read(Object target, BlobReader reader)
        {
            if(target != null)
                reader = reader.ReadFieldBlob();

            object result = Activator.CreateInstance(targetType);

            read_field:
            while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
            {
                reader.ReadFieldHeader();

                for(int i = 0; i < fields.Length; i++)
                {
                    var field = fields[i];

                    if ((field.PeekIntKey != -1 && field.PeekIntKey == reader.PeekIntKey) || 
                        (field.ByteKey.Length == reader.FieldKeyBytes && BlobUtil.UnsafeCompare(field.ByteKey, reader.ByteKey)))
                    {
                        field.Serializer.Read(result, reader);
                        goto read_field;
                    }
                }

                reader.SkipField();
            }

            reader.SkipSpare();

            if (target != null)
                reader.Dispose();

            return result;
        }
コード例 #2
0
        public object Read(Object target, BlobReader reader)
        {
            if (target != null)
            {
                reader = reader.ReadFieldBlob();
            }

            object result = Activator.CreateInstance(targetType);

read_field:
            while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
            {
                reader.ReadFieldHeader();

                for (int i = 0; i < fields.Length; i++)
                {
                    var field = fields[i];

                    if ((field.PeekIntKey != -1 && field.PeekIntKey == reader.PeekIntKey) ||
                        (field.ByteKey.Length == reader.FieldKeyBytes && BlobUtil.UnsafeCompare(field.ByteKey, reader.ByteKey)))
                    {
                        field.Serializer.Read(result, reader);
                        goto read_field;
                    }
                }

                reader.SkipField();
            }

            reader.SkipSpare();

            if (target != null)
            {
                reader.Dispose();
            }

            return(result);
        }