Documentation
¶
Index ¶
- Constants
- Variables
- func AppendInt(b []byte, v int) []byte
- func AppendInt32(b []byte, v int32) []byte
- func AppendInt64(b []byte, v int64) []byte
- func AppendUint(b []byte, v uint) []byte
- func AppendUint32(b []byte, v uint32) []byte
- func AppendUint64(b []byte, v uint64) []byte
- func Int(b []byte) (v int, n int)
- func Int32(b []byte) (v int32, n int)
- func Int64(b []byte) (v int64, n int)
- func ReadInt(r io.ByteReader) (v int, n int, err error)
- func ReadInt32(r io.ByteReader) (v int32, n int, err error)
- func ReadInt64(r io.ByteReader) (v int64, n int, err error)
- func ReadUint(r io.ByteReader) (v uint, n int, err error)
- func ReadUint32(r io.ByteReader) (v uint32, n int, err error)
- func ReadUint64(r io.ByteReader) (v uint64, n int, err error)
- func Uint(b []byte) (v uint, n int)
- func Uint32(b []byte) (v uint32, n int)
- func Uint64(b []byte) (v uint64, n int)
- func WriteInt(w io.ByteWriter, v int) (n int, err error)
- func WriteInt32(w io.ByteWriter, v int32) (n int, err error)
- func WriteInt64(w io.ByteWriter, v int64) (n int, err error)
- func WriteUint(w io.ByteWriter, v uint) (n int, err error)
- func WriteUint32(w io.ByteWriter, v uint32) (n int, err error)
- func WriteUint64(w io.ByteWriter, v uint64) (n int, err error)
Constants ¶
const ( // Maximum length of integer // encoded forms in bytes. MaxLen32 = 5 MaxLen64 = 10 )
Variables ¶
var ErrOverflow = errors.New("value overflow")
ErrOverflow is returned when an attempted read of a constrained size int / uint overflows container type.
Functions ¶
func AppendInt32 ¶
AppendInt32 appends LEB128 encoded form of int32 into given buffer, returning result.
func AppendInt64 ¶
AppendInt64 appends LEB128 encoded form of int64 into given buffer, returning result.
func AppendUint ¶
AppendUint: see AppendUint32 / AppendUint64 depending on platform integer size.
func AppendUint32 ¶
AppendInt32 appends LEB128 encoded form of uint32 into given buffer, returning result.
func AppendUint64 ¶
AppendInt64 appends LEB128 encoded form of int64 into given buffer, returning result.
func Int32 ¶
Int32 reads LEB128 encoded signed value from slice, up to a maximum size of 32 bits. Returns value and number of bytes read. Will return n=-1 on invalid varint or int32 overflow.
func Int64 ¶
Int64 reads LEB128 encoded signed value from slice, up to a maximum size of 64 bits. Returns value and number of bytes read. Will return n=-1 on invalid varint or int64 overflow.
func ReadInt ¶
func ReadInt(r io.ByteReader) (v int, n int, err error)
ReadInt: see ReadInt32 / ReadInt64 depending on platform integer size.
func ReadInt32 ¶
func ReadInt32(r io.ByteReader) (v int32, n int, err error)
ReadInt32 reads LEB128 encoded signed value from byte reader, up to a maximum size of 32 bits. Returns value, number of bytes read and error. Will return ErrOverflow on int32 overflow.
func ReadInt64 ¶
func ReadInt64(r io.ByteReader) (v int64, n int, err error)
ReadInt64 reads LEB128 encoded signed value from byte reader, up to a maximum size of 64 bits. Returns value, number of bytes read and error. Will return ErrOverflow on int64 overflow.
func ReadUint ¶
func ReadUint(r io.ByteReader) (v uint, n int, err error)
ReadUint: see ReadUint32 / ReadUint64 depending on platform integer size.
func ReadUint32 ¶
func ReadUint32(r io.ByteReader) (v uint32, n int, err error)
ReadUint32 reads LEB128 encoded unsigned value from byte reader, up to a maximum size of 32 bits. Returns value, number of bytes read and error. Will return ErrOverflow on uint32 overflow.
func ReadUint64 ¶
func ReadUint64(r io.ByteReader) (v uint64, n int, err error)
ReadUint64 reads LEB128 encoded unsigned value from byte reader, up to a maximum size of 64 bits. Returns value, number of bytes read and error. Will return ErrOverflow on int64 overflow.
func Uint32 ¶
Uint32 reads LEB128 encoded unsigned value from slice, up to a maximum size of 32 bits. Returns value and number of bytes read. Will return n=-1 on invalid varint or uint32 overflow.
func Uint64 ¶
Uint32 reads LEB128 encoded unsigned value from slice, up to a maximum size of 64 bits. Returns value and number of bytes read. Will return n=-1 on invalid varint or uint64 overflow.
func WriteInt ¶
func WriteInt(w io.ByteWriter, v int) (n int, err error)
WriteInt: see WriteInt32 / WriteInt64 depending on platform integer size.
func WriteInt32 ¶
func WriteInt32(w io.ByteWriter, v int32) (n int, err error)
WriteInt32 writes LEB128 encoded form of int32 to byte writer, returning bytes written and any write error.
func WriteInt64 ¶
func WriteInt64(w io.ByteWriter, v int64) (n int, err error)
WriteInt64 writes LEB128 encoded form of int64 to byte writer, returning bytes written and any write error.
func WriteUint ¶
func WriteUint(w io.ByteWriter, v uint) (n int, err error)
WriteUint: see WriteUint32 / WriteUint64 depending on platform integer size.
func WriteUint32 ¶
func WriteUint32(w io.ByteWriter, v uint32) (n int, err error)
WriteUint32 writes LEB128 encoded form of uint32 to byte writer, returning bytes written and any write error.
func WriteUint64 ¶
func WriteUint64(w io.ByteWriter, v uint64) (n int, err error)
WriteUint64 writes LEB128 encoded form of uint64 to byte writer, returning bytes written and any write error.
Types ¶
This section is empty.