github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/protocol/buffer.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package protocol
     4  
     5  import "io"
     6  
     7  type Buffer interface {
     8  	Reset()
     9  
    10  	Read(limit uint) []byte
    11  	ReadAt(offset, limit uint) []byte
    12  	Get() []byte
    13  	GetUnread() []byte
    14  
    15  	Write(s []byte)
    16  	WriteAt(s []byte, offset uint)
    17  	WriteString(s string)
    18  	WriteStringAt(s string, offset uint)
    19  	WriteByte(b byte) Error
    20  	WriteByteAt(b byte, offset uint)
    21  	Set(data []byte)
    22  
    23  	Cap() int
    24  	Len() int
    25  	LenOfUnread() int
    26  
    27  	Grow(n int)
    28  	GrowLen(n int) (lenBeforeGrow int)
    29  
    30  	// Split buffer to x part
    31  	Split(size int)
    32  	Parts() []Codec
    33  	Part(id uint) Codec
    34  
    35  	io.WriterTo
    36  	io.ReaderFrom
    37  }