Package pbutil provides record length-delimited Protocol Buffer streaming.
Internal call graph ▹
Internal call graph ▾
In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls—perhaps dynamically.
The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package.
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring
Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed.
func ReadDelimited ¶
func ReadDelimited(r io.Reader, m proto.Message) (n int, err error)
ReadDelimited decodes a message from the provided length-delimited stream, where the length is encoded as 32-bit varint prefix to the message body. It returns the total number of bytes read and any applicable error. This is roughly equivalent to the companion Java API's MessageLite#parseDelimitedFrom. As per the reader contract, this function calls r.Read repeatedly as required until exactly one message including its prefix is read and decoded (or an error has occurred). The function never reads more bytes from the stream than required. The function never returns an error if a message has been read and decoded correctly, even if the end of the stream has been reached in doing so. In that case, any subsequent calls return (0, io.EOF).
func WriteDelimited ¶
func WriteDelimited(w io.Writer, m proto.Message) (n int, err error)
WriteDelimited encodes and dumps a message to the provided writer prefixed with a 32-bit varint indicating the length of the encoded message, producing a length-delimited record stream, which can be used to chain together encoded messages of the same type together in a file. It returns the total number of bytes written and any applicable error. This is roughly equivalent to the companion Java API's MessageLite#writeDelimitedTo.