Documentation
¶
Overview ¶
Package encoding provides safe, atomic utility methods for encoding/saving to disk and loading from disk/decoding of data in common formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadAndUnmarshalProtobuf ¶
LoadAndUnmarshalProtobuf loads data from the specified path and decodes it into the specified Protocol Buffers message.
func LoadAndUnmarshalTOML ¶
LoadAndUnmarshalTOML loads data from the specified path and decodes it into the specified structure.
Types ¶
type ProtobufDecoder ¶ added in v0.7.0
type ProtobufDecoder struct {
// contains filtered or unexported fields
}
ProtobufEncoder is a stream decoder for Protocol Buffers messages.
func NewProtobufDecoder ¶ added in v0.7.0
func NewProtobufDecoder(reader io.Reader) *ProtobufDecoder
NewProtobufEncoder creates a new Protocol Buffers stream decoder.
type ProtobufEncoder ¶ added in v0.7.0
type ProtobufEncoder struct {
// contains filtered or unexported fields
}
ProtobufEncoder is a stream encoder for Protocol Buffers messages.
func NewProtobufEncoder ¶ added in v0.7.0
func NewProtobufEncoder(writer io.Writer) *ProtobufEncoder
NewProtobufEncoder creates a new Protocol Buffers stream encoder.
func (*ProtobufEncoder) Encode ¶ added in v0.7.0
func (e *ProtobufEncoder) Encode(message proto.Message) error
EncodeWithoutFlush encodes a length-prefixed Protocol Buffers message into the encoder's internal buffer and writes this data to the underlying stream.
func (*ProtobufEncoder) EncodeWithoutFlush ¶ added in v0.7.0
func (e *ProtobufEncoder) EncodeWithoutFlush(message proto.Message) error
EncodeWithoutFlush encodes a length-prefixed Protocol Buffers message into the encoder's internal buffer, but does not write this data to the underlying stream.
func (*ProtobufEncoder) Flush ¶ added in v0.7.0
func (e *ProtobufEncoder) Flush() error
Flush writes the contents of the encoder's internal buffer, if any, to the underlying stream.