part

package
v0.28.20240115133204 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 11 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")
	ErrNoDir            = errors.New("ErrNoDir")
	ErrArg              = errors.New("ErrArg")
)

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) CopyFromIoReader added in v0.28.1

func (t *File) CopyFromIoReader(from io.Reader, copyIOConfig pio.CopyConfig) error

func (*File) CopyTo

func (t *File) CopyTo(to *File, copyIOConfig pio.CopyConfig, tryLock bool) error

func (*File) CopyToIoWriter added in v0.10.14

func (t *File) CopyToIoWriter(to io.Writer, copyIOConfig pio.CopyConfig) error

func (*File) CopyToUntil added in v0.28.1

func (t *File) CopyToUntil(to *File, untilBytes []byte, perReadSize int, maxReadSize int, tryLock bool) (e error)

stop after untilBytes

data not include untilBytes

func (*File) Create added in v0.23.7

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

func (*File) CurIndex added in v0.28.1

func (t *File) CurIndex() (ret int64, err error)

func (*File) Delete

func (t *File) Delete() error

func (*File) DirFiles added in v0.28.1

func (t *File) DirFiles() (files []string, err 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(untilBytes []byte, perReadSize int, maxReadSize int) (data []byte, e error)

stop after untilBytes

data not include untilBytes

func (*File) SeekIndex added in v0.28.1

func (t *File) SeekIndex(index int64, whence FileWhence) (e error)

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

func (*File) SeekUntil added in v0.28.1

func (t *File) SeekUntil(untilBytes []byte, whence FileWhence, perReadSize int, maxReadSize int) (e error)

stop before untilBytes

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