part

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 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
	// 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()

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 int) (e error)

Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any. The behavior of Seek on a file opened with O_APPEND is not specified.

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