part

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilePathTooLong  = errors.New("ErrFilePathTooLong")
	ErrNewFileCantSeed  = errors.New("ErrNewFileCantSeed")
	ErrFailToLock       = errors.New("ErrFailToLock")
	ErrMaxReadSizeReach = errors.New("ErrMaxReadSizeReach")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	FilePath  string //文件路径
	CurIndex  int64  //初始化光标位置
	AutoClose bool   //自动关闭句柄

	// wrap with encoder
	//https://pkg.go.dev/golang.org/x/text/encoding#section-directories
	Coder encoder.Encoding
}

type File

type File struct {
	Config Config

	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(filePath string, curIndex int64, autoClose bool) *File

func (*File) Close

func (t *File) Close() error

func (*File) CopyTo

func (t *File) CopyTo(to *File, byteInSec int64, tryLock bool) error

func (*File) CopyToIoWriter added in v0.10.14

func (t *File) CopyToIoWriter(to io.Writer, byteInSec int64, tryLock bool) error

func (*File) Delete

func (t *File) Delete() error

func (*File) File added in v0.10.16

func (t *File) File() *os.File

func (*File) IsExist added in v0.10.2

func (t *File) IsExist() bool

func (*File) Read

func (t *File) Read(data []byte) (int, error)

func (*File) ReadAll added in v0.10.15

func (t *File) ReadAll(perReadSize int, maxReadSize int) (data []byte, e error)

func (*File) ReadUntil

func (t *File) ReadUntil(separation byte, perReadSize int, maxReadSize int) (data []byte, e error)

func (*File) Seed

func (t *File) Seed(index int64) (e error)

func (*File) Sync added in v0.10.4

func (t *File) Sync() (e error)

func (*File) Write

func (t *File) Write(data []byte, tryLock bool) (int, error)

Jump to

Keyboard shortcuts

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