Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileIO ¶
type FileIO interface {
Path() Path
WriteText(text string, opt *Options, mkdirs bool) error
WriteBinary(data []byte, opt *Options, mkdirs bool) error
ReadText(opt *Options) (string, error)
ReadBinary(opt *Options) ([]byte, error)
OpenReader(opt *Options) (io.ReadCloser, error)
OpenWriter(opt *Options, mkdirs bool) (io.WriteCloser, error)
}
FileIO 表示对一个具体文件的IO
type FileMeta ¶
type FileMeta interface {
LastModTime() int64
Mode() os.FileMode
Size() int64
IsFile() bool
IsDir() bool
IsSymlink() bool
Exists() bool
CanExecute() bool
CanRead() bool
CanWrite() bool
}
FileMeta 表示对一个具体文件的 posix liked mode
type FileSystem ¶
type FileSystem interface {
Roots() []Path
Resolve(path string) (Path, error)
GetPath(path string) Path
GetPathByURI(uri lang.URI) (Path, error)
IsAbsolute(path string) bool
Separator() string
SeparatorChar() rune
PathSeparator() string
PathSeparatorChar() rune
DefaultReadOptions() *Options
DefaultWriteOptions() *Options
SetDefaultOptions(r *Options, w *Options)
}
FileSystem 代表一个抽象的文件系统
type Path ¶
type Path interface {
URI() lang.URI
String() string
Parent() Path
FileSystem() FileSystem
Path() string
Name() string
Exists() bool
IsDir() bool
IsFile() bool
IsSymlink() bool
LastModTime() int64 // ms from unix time(1970-01-01 00:00:00)
GetMeta() FileMeta
SetMeta(meta FileMeta) error
SetMode(mode os.FileMode) error
SetLastModTime(t int64) error // ms from unix time(1970-01-01 00:00:00)
Delete() error
Size() int64
GetIO() FileIO
CreateFile(opt *Options) error
CreateFileWithSize(size int64, opt *Options) error
CopyTo(target Path) error
MoveTo(target Path) error
Mkdir() error
Mkdirs() error
ListNames() []string // 返回短文件名
ListPaths() []string // 返回完整路径名
ListItems() []Path
GetChild(name string) Path
GetHref(name string) Path
}
Path 代表一个路径
Click to show internal directories.
Click to hide internal directories.