diff options
author | csharptest <roger@csharptest.net> | 2011-09-08 20:28:22 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-09-08 20:28:22 -0500 |
commit | 819b7154d162f3ef4f187f19b020f999c02fcf03 (patch) | |
tree | 143a7767ed58b124c452062cecc2f85f7d3da191 /src/ProtocolBuffers.Serialization/XmlFormatWriter.cs | |
parent | c2d2c1adaf447bbc80194d8bce6c4e0442a7f47a (diff) | |
download | protobuf-819b7154d162f3ef4f187f19b020f999c02fcf03.tar.gz protobuf-819b7154d162f3ef4f187f19b020f999c02fcf03.tar.bz2 protobuf-819b7154d162f3ef4f187f19b020f999c02fcf03.zip |
Added IDisposable to ICodedOutputStream
Diffstat (limited to 'src/ProtocolBuffers.Serialization/XmlFormatWriter.cs')
-rw-r--r-- | src/ProtocolBuffers.Serialization/XmlFormatWriter.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index 97fc6b2c..a9cfcc1e 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -75,8 +75,13 @@ namespace Google.ProtocolBuffers.Serialization {
if (disposing)
{
+ if (_output.WriteState != WriteState.Closed && _output.WriteState != WriteState.Start)
+ _output.WriteEndDocument();
+
_output.Close();
}
+
+ base.Dispose(disposing);
}
/// <summary>
@@ -112,6 +117,15 @@ namespace Google.ProtocolBuffers.Serialization }
/// <summary>
+ /// Completes any pending write operations
+ /// </summary>
+ public override void Flush()
+ {
+ _output.Flush();
+ base.Flush();
+ }
+
+ /// <summary>
/// Used to write the root-message preamble, in xml this is open element for RootElementName,
/// by default "<root>". After this call you can call IMessageLite.MergeTo(...) and
/// complete the message with a call to EndMessage().
|