Пример #1
0
        public void CloseSection()
        {
            if (this.bufferState != XmlBuffer.BufferState.Writing)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.CreateInvalidStateException());
            }
            this.writer.Close();
            this.bufferState = XmlBuffer.BufferState.Created;
            int size = (int)this.stream.Length - this.offset;

            this.sections.Add(new XmlBuffer.Section(this.offset, size, this.quotas));
            this.offset = this.offset + size;
        }
Пример #2
0
        public void Close()
        {
            if (this.bufferState != XmlBuffer.BufferState.Created)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.CreateInvalidStateException());
            }
            this.bufferState = XmlBuffer.BufferState.Reading;
            int bufferSize;

            this.buffer = this.stream.ToArray(out bufferSize);
            this.writer = (XmlDictionaryWriter)null;
            this.stream = (BufferedOutputStream)null;
        }
Пример #3
0
 public XmlDictionaryWriter OpenSection(XmlDictionaryReaderQuotas quotas)
 {
     if (this.bufferState != XmlBuffer.BufferState.Created)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.CreateInvalidStateException());
     }
     this.bufferState = XmlBuffer.BufferState.Writing;
     this.quotas      = new XmlDictionaryReaderQuotas();
     quotas.CopyTo(this.quotas);
     if (this.writer == null)
     {
         this.writer = XmlDictionaryWriter.CreateBinaryWriter((Stream)this.stream, (IXmlDictionary)XD.Dictionary, (XmlBinaryWriterSession)null, true);
     }
     else
     {
         ((IXmlBinaryWriterInitializer)this.writer).SetOutput((Stream)this.stream, (IXmlDictionary)XD.Dictionary, (XmlBinaryWriterSession)null, true);
     }
     return(this.writer);
 }