utils

package
v0.0.0-...-5c7ffcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInode

func GetInode(stat os.FileInfo) uint64

func TrimCRLFString

func TrimCRLFString(s string) string

Types

type LineBuffer

type LineBuffer struct {
	// contains filtered or unexported fields
}

积累bytes的缓冲器, 可以扫描出多个行

func NewLineBuffer

func NewLineBuffer(maxSize int) *LineBuffer

func (*LineBuffer) Add

func (buf *LineBuffer) Add(a []byte)

往buffer里添加一些bytes

func (*LineBuffer) AvailableLines

func (buf *LineBuffer) AvailableLines() int

数一下有多少行是可用的, 就是数一下\n的个数

func (*LineBuffer) Clear

func (buf *LineBuffer) Clear()

func (*LineBuffer) Empty

func (buf *LineBuffer) Empty() bool

func (*LineBuffer) IsBroken

func (buf *LineBuffer) IsBroken() bool

func (*LineBuffer) LoadState

func (buf *LineBuffer) LoadState(state *LineBufferStateObj)

func (*LineBuffer) Next

func (buf *LineBuffer) Next() ([]byte, bool)

尝试解析出一行, 如果成功则返回 line, true 否则返回 "", false

func (*LineBuffer) SaveState

func (buf *LineBuffer) SaveState() *LineBufferStateObj

type LineBufferStateObj

type LineBufferStateObj struct {
	Buffer []byte
	Add    []byte
	Broken bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL