Documentation ¶
Index ¶
- type Reader
- func (s *Reader) Error() error
- func (s *Reader) Read(x interface{})
- func (s *Reader) ReadBytes(l int) []byte
- func (s *Reader) ReadFloat64() float64
- func (s *Reader) ReadInt16() int16
- func (s *Reader) ReadInt32() int32
- func (s *Reader) ReadInt64() int64
- func (s *Reader) ReadInt8() int8
- func (s *Reader) ReadUint16() uint16
- func (s *Reader) ReadUint16PrefixedBytes() []byte
- func (s *Reader) ReadUint16PrefixedString() string
- func (s *Reader) ReadUint32() uint32
- func (s *Reader) ReadUint64() uint64
- func (s *Reader) ReadUint8() uint8
- func (s *Reader) ReadUnixTime64UTC() time.Time
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps a reader with calls for reading binary data types If any error is encountered, all subsequent calls will fail error checking must be done in a separate call to error
func (*Reader) Read ¶
func (s *Reader) Read(x interface{})
Read takes a pointer to a data type (e.g. uint16, int64, []byte) and reads data from the wrapped reader, and advances the reader offset to the next value.
func (*Reader) ReadUint16PrefixedBytes ¶
ReadUint16PrefixedBytes first reads a uint16, then reads that many following bytes
func (*Reader) ReadUint16PrefixedString ¶
ReadUint16PrefixedString first reads a uint16, then reads that many following chars
func (*Reader) ReadUnixTime64UTC ¶
ReadUnixTime64UTC reads a uint64 representing unix epoch time in UTC and converts it to a time.time
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer wraps a writer with calls for writing binary data types If any error is encountered, all subsequent calls will fail error checking must be done in a separate call to error
func (*Writer) Write ¶
func (s *Writer) Write(x interface{})
Write writes a given type to the stream
func (*Writer) WriteUint16PrefixedBytes ¶
WriteUint16PrefixedBytes writes a uint16 specifying the length of the bytes buffer, followed by the payload
func (*Writer) WriteUint16PrefixedString ¶
WriteUint16PrefixedString writes a uint16 specifying the length of the string, followed by the actual string
func (*Writer) WriteUnixTime64UTC ¶
WriteUnixTime64UTC writes a time as unix epoch in UTC; sub-second accuracy is truncated