github.com/webmafia/fast@v0.10.0/binary/interface.go (about)

     1  package binary
     2  
     3  import "io"
     4  
     5  type Reader interface {
     6  	io.Reader
     7  	io.ByteReader
     8  
     9  	Len() int
    10  	Cap() int
    11  	ReadBytes(n int) []byte
    12  	ReadString(n int) string
    13  	ReadUint8() uint8
    14  	ReadInt8() int8
    15  	ReadUint16() uint16
    16  	ReadInt16() int16
    17  	ReadUint32() uint32
    18  	ReadInt32() int32
    19  	ReadUint64() uint64
    20  	ReadInt64() int64
    21  	ReadInt() int
    22  	ReadUint() uint
    23  	ReadFloat32() float32
    24  	ReadFloat64() float64
    25  	ReadVarint() int64
    26  	ReadUvarint() uint64
    27  	ReadBool() bool
    28  }
    29  
    30  type Writer interface {
    31  	io.Writer
    32  	io.ByteWriter
    33  
    34  	WriteString(s string) (int, error)
    35  	WriteUint8(v uint8) error
    36  	WriteInt8(v int8) error
    37  	WriteUint16(v uint16) error
    38  	WriteInt16(v int16) error
    39  	WriteUint32(v uint32) error
    40  	WriteInt32(v int32) error
    41  	WriteUint64(v uint64) error
    42  	WriteInt64(v int64) error
    43  	WriteInt(v int) error
    44  	WriteUint(v uint) error
    45  	WriteFloat32(v float32) error
    46  	WriteFloat64(v float64) error
    47  	WriteVarint(v int64) error
    48  	WriteUvarint(v uint64) error
    49  	WriteBool(v bool) error
    50  	WriteEnc(v Encoder) error
    51  	WriteVal(val any) error
    52  }
    53  
    54  type Encoder interface {
    55  	Encode(w Writer) error
    56  }