class ZeroCopyInputStream
Defined at line 101 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
Abstract interface similar to an input stream but designed to minimize
copying.
Public Methods
bool Next (const void ** data, int * size)
Obtains a chunk of data from the stream.
Preconditions:
* "size" and "data" are not NULL.
Postconditions:
* If the returned value is false, there is no more data to return or
an error occurred. All errors are permanent.
* Otherwise, "size" points to the actual number of bytes read and "data"
points to a pointer to a buffer containing these bytes.
* Ownership of this buffer remains with the stream, and the buffer
remains valid only until some other method of the stream is called
or the stream is destroyed.
* It is legal for the returned buffer to have zero size, as long
as repeatedly calling Next() eventually yields a buffer with non-zero
size.
void BackUp (int count)
Backs up a number of bytes, so that the next call to Next() returns
data again that was already returned by the last call to Next(). This
is useful when writing procedures that are only supposed to read up
to a certain point in the input, then return. If Next() returns a
buffer that goes beyond what you wanted to read, you can use BackUp()
to return to the point where you intended to finish.
Preconditions:
* The last method called must have been Next().
* count must be less than or equal to the size of the last buffer
returned by Next().
Postconditions:
* The last "count" bytes of the last buffer returned by Next() will be
pushed back into the stream. Subsequent calls to Next() will return
the same data again before producing new data.
bool Skip (int count)
Skips `count` number of bytes.
Returns true on success, or false if some input error occurred, or `count`
exceeds the end of the stream. This function may skip up to `count - 1`
bytes in case of failure.
Preconditions:
* `count` is non-negative.
int64_t ByteCount ()
Returns the total number of bytes read since this object was created.
bool ReadCord (absl::Cord * cord, int count)
Read the next `count` bytes and append it to the given Cord.
In the case of a read error, the method reads as much data as possible into
the cord before returning false. The default implementation iterates over
the buffers and appends up to `count` bytes of data into `cord` using the
`absl::CordBuffer` API.
Some streams may implement this in a way that avoids copying by sharing or
reference counting existing data managed by the stream implementation.
void ZeroCopyInputStream ()
Defined at line 103 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
void ~ZeroCopyInputStream ()
Defined at line 104 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
void ZeroCopyInputStream (const ZeroCopyInputStream & )
Defined at line 106 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
ZeroCopyInputStream & operator= (const ZeroCopyInputStream & )
Defined at line 107 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
void ZeroCopyInputStream (ZeroCopyInputStream && )
Defined at line 108 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h
ZeroCopyInputStream & operator= (ZeroCopyInputStream && )
Defined at line 109 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h