import "github.com/byte-mug/golibs/preciseio"
Extended IO Routines to construct Serializers/Deserializers to directly operate on bufio-Reader/bufio-Writer.
var EBlobTooLong = errors.New("Blob too long")
-
var EListTooLong = errors.New("List too long")
-
type PreciseReader struct { R Reader }
-
func (pr PreciseReader) ReadBlob() ([]byte, error)
-
func (pr PreciseReader) ReadListLength() (int, error)
-
func (pr PreciseReader) ReadUvarint() (uint64, error)
-
func (pr PreciseReader) ReadVarint() (int64, error)
-
type PreciseWriter struct { W Writer // contains filtered or unexported fields }
-
func PreciseWriterFromPool() *PreciseWriter
Gets an initialized PreciseWriter from the Pool.
func (pw *PreciseWriter) Initialize()
This function initializes the internal fields. This must be called before any use.
func (w *PreciseWriter) PutToPool()
Puts the PrecideWriter to the Pool, so it can be reallocated by PreciseWriterFromPool().
func (pw PreciseWriter) WriteBlob(b []byte) error
-
func (pw PreciseWriter) WriteListLength(i int) error
-
func (pw PreciseWriter) WriteUvarint(i uint64) error
-
func (pw PreciseWriter) WriteVarint(i int64) error
-
type Reader interface { io.Reader ReadByte() (byte, error) }
-
type Writer interface { io.Writer WriteByte(c byte) error }
-
import "encoding/binary"
import "errors"
import "io"
import "sync"