part

package
v0.27.15 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 10 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
	// 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) Create added in v0.23.7

func (t *File) Create(mode ...fs.FileMode)

func (*File) Delete

func (t *File) Delete() error

func (*File) File added in v0.10.16

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

func (*File) IsDir added in v0.22.6

func (t *File) IsDir() bool

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, whence FileWhence) (e error)

Seek sets the offset for the next Read or Write on file to offset

func (*File) Stat added in v0.24.11

func (t *File) Stat() (fs.FileInfo, 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)

type FileWhence added in v0.24.11

type FileWhence int
const (
	AtOrigin FileWhence = iota
	AtCurrent
	AtEnd
)

Jump to

Keyboard shortcuts

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