using System.IO; namespace ProtoBuf { /// /// Provides addition capability for supporting unexpected fields during /// protocol-buffer serialization/deserialization. This allows for loss-less /// round-trip/merge, even when the data is not fully understood. /// public interface IExtension { /// /// Requests a stream into which any unexpected fields can be persisted. /// /// A new stream suitable for storing data. Stream BeginAppend(); /// /// Indicates that all unexpected fields have now been stored. The /// implementing class is responsible for closing the stream. If /// "commit" is not true the data may be discarded. /// /// The stream originally obtained by BeginAppend. /// True if the append operation completed successfully. void EndAppend(Stream stream, bool commit); /// /// Requests a stream of the unexpected fields previously stored. /// /// A prepared stream of the unexpected fields. Stream BeginQuery(); /// /// Indicates that all unexpected fields have now been read. The /// implementing class is responsible for closing the stream. /// /// The stream originally obtained by BeginQuery. void EndQuery(Stream stream); /// /// Requests the length of the raw binary stream; this is used /// when serializing sub-entities to indicate the expected size. /// /// The length of the binary stream representing unexpected data. int GetLength(); } }