@@ -157,13 +157,6 @@ class PROTOBUF_EXPORT ZeroCopyInputStream {
157157 // buffer that goes beyond what you wanted to read, you can use BackUp()
158158 // to return to the point where you intended to finish.
159159 //
160- // This method can be called with `count = 0` to finalize (flush) any
161- // previously returned buffer. For example, a file output stream can
162- // flush buffers returned from a previous call to Next() upon such
163- // BackUp(0) invocations. ZeroCopyOutputStream callers should always
164- // invoke BackUp() after a final Next() call, even if there is no
165- // excess buffer data to be backed up to indicate a flush point.
166- //
167160 // Preconditions:
168161 // * The last method called must have been Next().
169162 // * count must be less than or equal to the size of the last buffer
@@ -175,10 +168,14 @@ class PROTOBUF_EXPORT ZeroCopyInputStream {
175168 // the same data again before producing new data.
176169 virtual void BackUp (int count) = 0;
177170
178- // Skips a number of bytes. Returns false if the end of the stream is
179- // reached or some input error occurred. In the end-of-stream case, the
180- // stream is advanced to the end of the stream (so ByteCount() will return
181- // the total size of the stream).
171+ // Skips `count` number of bytes.
172+ // Returns true on success, or false if some input error occurred, or `count`
173+ // exceeds the end of the stream. This function may skip up to `count - 1`
174+ // bytes in case of failure.
175+ //
176+ // Preconditions:
177+ // * `count` is non-negative.
178+ //
182179 virtual bool Skip (int count) = 0;
183180
184181 // Returns the total number of bytes read since this object was created.
@@ -235,6 +232,13 @@ class PROTOBUF_EXPORT ZeroCopyOutputStream {
235232 // than you needed. You don't want to write a bunch of garbage after the
236233 // end of your data, so you use BackUp() to back up.
237234 //
235+ // This method can be called with `count = 0` to finalize (flush) any
236+ // previously returned buffer. For example, a file output stream can
237+ // flush buffers returned from a previous call to Next() upon such
238+ // BackUp(0) invocations. ZeroCopyOutputStream callers should always
239+ // invoke BackUp() after a final Next() call, even if there is no
240+ // excess buffer data to be backed up to indicate a flush point.
241+ //
238242 // Preconditions:
239243 // * The last method called must have been Next().
240244 // * count must be less than or equal to the size of the last buffer
0 commit comments