Documentation ¶
Index ¶
- Constants
- func SetDefaultFSFactory(factory FileSystemFactory) error
- type FS
- type FileIO
- type FileInfo
- type FileSystemFactory
- type NopReaderPool
- type Options
- type OptionsBuilder
- func (inst *OptionsBuilder) Append(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) Create(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) Dir(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) File(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) FromBegin(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) Mkdirs(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) Options() *Options
- func (inst *OptionsBuilder) Read(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) ResetLength(value bool) *OptionsBuilder
- func (inst *OptionsBuilder) Write(value bool) *OptionsBuilder
- type OptionsHandlerFunc
- type Path
- type ReadWriteSeekCloser
- type ReaderPool
- type WantOption
- type WriteSeekCloser
Constants ¶
View Source
const ( WantToMakeDir = 0x0001 WantToReadFile = 0x0002 WantToWriteFile = 0x0004 WantToCreateFile = 0x0008 )
定义 WantOption
Variables ¶
This section is empty.
Functions ¶
func SetDefaultFSFactory ¶
func SetDefaultFSFactory(factory FileSystemFactory) error
SetDefaultFSFactory 在调用 Default() 之前,必须设置默认的工厂
Types ¶
type FS ¶
type FS interface { NewPath(path string) Path ListRoots() []Path CreateTempFile(prefix, suffix string, dir Path) (Path, error) // PathSeparator return ';'(windows) | ':'(unix) PathSeparator() string // Separator return '/'(unix) | '\'(windows) Separator() string }
FS 是表示文件系统的接口
type FileIO ¶
type FileIO interface { Path() Path OpenReader(opt *Options) (io.ReadCloser, error) OpenWriter(opt *Options) (io.WriteCloser, error) OpenSeekerR(opt *Options) (io.ReadSeekCloser, error) OpenSeekerW(opt *Options) (WriteSeekCloser, error) OpenSeekerRW(opt *Options) (ReadWriteSeekCloser, error) ReadText(opt *Options) (string, error) WriteText(text string, opt *Options) error WriteBinary(b []byte, opt *Options) error ReadBinary(opt *Options) ([]byte, error) }
FileIO ...
type FileInfo ¶
type FileInfo interface { Path() Path Length() int64 CreatedAt() time.Time UpdatedAt() time.Time Mode() fs.FileMode Exists() bool IsFile() bool IsDirectory() bool }
FileInfo ...
type FileSystemFactory ¶
type FileSystemFactory interface {
Create() FS
}
FileSystemFactory 是用来创建 FS 对象的工厂
type NopReaderPool ¶
type NopReaderPool struct { }
NopReaderPool ...
func (*NopReaderPool) OpenReader ¶
func (inst *NopReaderPool) OpenReader(file Path, op *Options) (io.ReadSeekCloser, error)
OpenReader ...
type Options ¶
type Options struct { // fill with fs.ModeXXX Permission fs.FileMode // fill with os.O_xxxx Flag int }
Options ...
type OptionsBuilder ¶ added in v0.9.4
type OptionsBuilder struct {
// contains filtered or unexported fields
}
OptionsBuilder 用于创建复合的 Options
func (*OptionsBuilder) Append ¶ added in v0.9.4
func (inst *OptionsBuilder) Append(value bool) *OptionsBuilder
Append ...
func (*OptionsBuilder) Create ¶ added in v0.9.4
func (inst *OptionsBuilder) Create(value bool) *OptionsBuilder
Create ...
func (*OptionsBuilder) Dir ¶ added in v0.9.4
func (inst *OptionsBuilder) Dir(value bool) *OptionsBuilder
Dir ...
func (*OptionsBuilder) File ¶ added in v0.9.4
func (inst *OptionsBuilder) File(value bool) *OptionsBuilder
File ...
func (*OptionsBuilder) FromBegin ¶ added in v0.9.4
func (inst *OptionsBuilder) FromBegin(value bool) *OptionsBuilder
FromBegin ...
func (*OptionsBuilder) Mkdirs ¶ added in v0.9.4
func (inst *OptionsBuilder) Mkdirs(value bool) *OptionsBuilder
Mkdirs ...
func (*OptionsBuilder) Options ¶ added in v0.9.4
func (inst *OptionsBuilder) Options() *Options
Options 创建 Options
func (*OptionsBuilder) Read ¶ added in v0.9.4
func (inst *OptionsBuilder) Read(value bool) *OptionsBuilder
Read ...
func (*OptionsBuilder) ResetLength ¶ added in v0.9.4
func (inst *OptionsBuilder) ResetLength(value bool) *OptionsBuilder
ResetLength ...
func (*OptionsBuilder) Write ¶ added in v0.9.4
func (inst *OptionsBuilder) Write(value bool) *OptionsBuilder
Write ...
type OptionsHandlerFunc ¶
type OptionsHandlerFunc func(path string, opt *Options, want WantOption) *Options
OptionsHandlerFunc 函数用于为I/O操作准备选项
type Path ¶
type Path interface { Exists() bool IsFile() bool IsDirectory() bool GetName() string GetPath() string GetInfo() FileInfo String() string GetFS() FS GetParent() Path GetChild(name string) Path ListNames() []string ListPaths() []string ListChildren() []Path Mkdir(opt *Options) error Mkdirs(opt *Options) error MakeParents(opt *Options) error Delete() error Create(opt *Options) error CreateWithData(data []byte, opt *Options) error CreateWithSource(src io.Reader, opt *Options) error MoveTo(dst Path, opt *Options) error CopyTo(dst Path, opt *Options) error GetIO() FileIO }
Path 是表示绝对路径的接口
type ReadWriteSeekCloser ¶
type ReadWriteSeekCloser interface { io.Closer io.ReadWriteSeeker }
ReadWriteSeekCloser ...
type ReaderPool ¶
type ReaderPool interface { io.Closer Clean() OpenReader(file Path, op *Options) (io.ReadSeekCloser, error) }
ReaderPool ...
type WriteSeekCloser ¶
type WriteSeekCloser interface { io.Closer io.WriteSeeker }
WriteSeekCloser ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.