aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers/IMessage.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2009-05-29 06:34:52 +0100
committerJon Skeet <skeet@pobox.com>2009-05-29 06:34:52 +0100
commit2e6dc12fa8e8cf58a8ab27838b11f929b5cf909b (patch)
treed91d424a60adc04ac4c63d6dad592aa141b0bb7b /src/ProtocolBuffers/IMessage.cs
parent43da7ae328b699d9c6e64ea909e348fac3506f73 (diff)
downloadprotobuf-2e6dc12fa8e8cf58a8ab27838b11f929b5cf909b.tar.gz
protobuf-2e6dc12fa8e8cf58a8ab27838b11f929b5cf909b.tar.bz2
protobuf-2e6dc12fa8e8cf58a8ab27838b11f929b5cf909b.zip
Write/Read delimited messages
Diffstat (limited to 'src/ProtocolBuffers/IMessage.cs')
-rw-r--r--src/ProtocolBuffers/IMessage.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ProtocolBuffers/IMessage.cs b/src/ProtocolBuffers/IMessage.cs
index e87bb52c..98b18a35 100644
--- a/src/ProtocolBuffers/IMessage.cs
+++ b/src/ProtocolBuffers/IMessage.cs
@@ -113,10 +113,27 @@ namespace Google.ProtocolBuffers {
/// Serializes the message and writes it to the given output stream.
/// This does not flush or close the stream.
/// </summary>
- /// <param name="output"></param>
+ /// <remarks>
+ /// Protocol Buffers are not self-delimiting. Therefore, if you write
+ /// any more data to the stream after the message, you must somehow ensure
+ /// that the parser on the receiving end does not interpret this as being
+ /// part of the protocol message. One way of doing this is by writing the size
+ /// of the message before the data, then making sure you limit the input to
+ /// that size when receiving the data. Alternatively, use WriteDelimitedTo(Stream).
+ /// </remarks>
void WriteTo(CodedOutputStream output);
/// <summary>
+ /// Like WriteTo(Stream) but writes the size of the message as a varint before
+ /// writing the data. This allows more data to be written to the stream after the
+ /// message without the need to delimit the message data yourself. Use
+ /// IBuilder.MergeDelimitedFrom(Stream) or the static method
+ /// YourMessageType.ParseDelimitedFrom(Stream) to parse messages written by this method.
+ /// </summary>
+ /// <param name="output"></param>
+ void WriteDelimitedTo(Stream output);
+
+ /// <summary>
/// Returns the number of bytes required to encode this message.
/// The result is only computed on the first call and memoized after that.
/// </summary>