github.com/pbberlin/tools@v0.0.0-20160910141205-7aa5421c2169/os/fsi/11_file_interface.go (about)

     1  package fsi
     2  
     3  import (
     4  	"io"
     5  	"os"
     6  )
     7  
     8  // Interface File is inspired by os.File,
     9  // and informed by godoc.vfs and package afero
    10  type File interface {
    11  	io.Closer
    12  	// Notice, we dont have an Opener on file.
    13  	// Opener is attached to filesystem one level higher.
    14  	io.Reader
    15  	io.ReaderAt
    16  	io.Seeker
    17  	io.Writer
    18  	io.WriterAt
    19  
    20  	//Fd() uintptr
    21  	Stat() (os.FileInfo, error)
    22  
    23  	// Close writes to disk; Sync is not neccessary
    24  	// Sync() error
    25  
    26  	// Readdir and Readdirnames come from os.File.
    27  	// Notice the distinctive signature and the remarks on FileSys.ReadDir(...)
    28  	//
    29  	// Notice the contract https://golang.org/src/os/doc.go
    30  	// For n > 0, returning io.EOF is important,
    31  	// otherwise http.FileServer will repeat queries forever.
    32  	//
    33  	// Example at https://golang.org/src/os/file_windows.go
    34  	Readdir(n int) ([]os.FileInfo, error)
    35  	Readdirnames(n int) ([]string, error)
    36  
    37  	WriteString(s string) (ret int, err error)
    38  	Truncate(size int64) error
    39  
    40  	Name() string
    41  
    42  	// Notice the indirect need to implement os.FileInfo
    43  	// because it is returned by Stat()
    44  	//	  Size() int64 {
    45  	//	  Mode() os.FileMode {
    46  	//	  ModTime() time.Time {
    47  	//	  IsDir() bool {
    48  	//	  Sys() interface{} {
    49  
    50  }