circle

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTooManyToWrite 内容太长,无法写入
	ErrTooManyToWrite = errors.New("too many data to write")
	// ErrInvalidBuffer 用于读取的 buffer 无效
	ErrInvalidBuffer = errors.New("invalid buffer")
	// ErrNotEnough 数据不足以读取长度 n 的内容
	ErrNotEnough = errors.New("not enough data")
)

Functions

This section is empty.

Types

type Circle

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

Circle 环形结构

func New

func New(size int) *Circle

New 创建环形结构

func (*Circle) Cap

func (c *Circle) Cap() int

Cap ..

func (*Circle) Free

func (c *Circle) Free() int

Free 剩余空间

func (*Circle) Len

func (c *Circle) Len() int

Len 有效 buffer 的长度

func (*Circle) Read

func (c *Circle) Read(p []byte) (int, error)

Read 读取尽量多的数据到 p 中 p: 数据会拷贝到 p 中 n: 读取到 P 中的数据长度

func (*Circle) ReadN

func (c *Circle) ReadN(n int, p []byte) error

ReadN 读取长度 n 的内容到 p 中 只存在读取了长度 n 的内容到 p 中,和 一点都不读取两种情况 不存在只读了部分(< n) 的内容到 p 中的情况

func (*Circle) String

func (c *Circle) String() string

func (*Circle) Write

func (c *Circle) Write(p []byte) (int, error)

Write 写入数据 只有全部写入,或者都不写入两种情况,不存在只写入一部分的情形

Jump to

Keyboard shortcuts

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