package pbutil
Import Path
github.com/matttproud/golang_protobuf_extensions/pbutil (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
decode.go
Package pbutil provides record length-delimited Protocol Buffer streaming.
encode.go
Package-Level Functions (total 2, both are exported)
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).
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.
Package-Level Variables (only one, which is unexported)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |