Documentation ¶
Index ¶
- Constants
- Variables
- func AddTrailingSep(s, sep string, keepNewLines bool) string
- func Fields(s string, sep string) []string
- func GetFileData(filename string) (string, error)
- func GetWriteCloser(filename string) (io.WriteCloser, error)
- func Lines(s string) []string
- func NormalizeWhitespace(s string) string
- type GoFile
- func (f *GoFile) Bytes() []byte
- func (f *GoFile) Closer() io.Closer
- func (f *GoFile) DebugDetails() []details
- func (f *GoFile) Ends(n int) string
- func (f *GoFile) Fields(sep string) []string
- func (f *GoFile) FileInfo() fs.FileInfo
- func (f *GoFile) Handle() (*os.File, io.Closer, error)
- func (f *GoFile) Head(n int) string
- func (f *GoFile) HeadBytes(n int) []byte
- func (f *GoFile) IsDir() bool
- func (f *GoFile) IsDirty() bool
- func (f *GoFile) Lines() []string
- func (f *GoFile) LoadData() error
- func (f *GoFile) ModTime() time.Time
- func (f *GoFile) Mode() fs.FileMode
- func (f *GoFile) Name() string
- func (f *GoFile) PrintDebugDetails(detailSet []details)
- func (f *GoFile) ReadAll() error
- func (f *GoFile) Reader() (io.ReadCloser, error)
- func (f *GoFile) SaveData() error
- func (f *GoFile) Size() int64
- func (f *GoFile) String() string
- func (f *GoFile) Tail(n int) string
- func (f *GoFile) TailBytes(n int) []byte
- func (f *GoFile) Writer() io.Writer
- type GoFile2
- type MemFile
- type RWCPlus
- type TimeZone
Constants ¶
const ( NormalMode os.FileMode = 0644 DirMode os.FileMode = 0755 MinBufferSize = 16 SmallBufferSize = 64 Chunk = 512 DefaultBufferSize = 1024 DefaultBufSize = 4096 MaxInt = int(^uint(0) >> 1) MinRead = bytes.MinRead )
const ( PathSep = os.PathSeparator ListSep = os.PathListSeparator NewLine = "\n" Tab = "\t" NL byte = '\n' TAB byte = '\t' NUL byte = 0 )
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
var (
V = cli.Vprintln
)
Functions ¶
func AddTrailingSep ¶
AddTrailingSep adds a trailing separator sep to each newline in s. The actual newline character can be kept or discarded based on the keepNewLines bool.
func GetFileData ¶
GetFileData returns the contents of the file as a string. If any error is encountered, the empty string is returned with the error.
func GetWriteCloser ¶
func GetWriteCloser(filename string) (io.WriteCloser, error)
GetWriteCloser returns an io.WriteCloser from the given filename if the file was opened successfully.
func NormalizeWhitespace ¶
NormalizeWhitespace splits s on any utf8 whitespace and returns each element as a single space separated string.
Types ¶
type GoFile ¶
type GoFile struct {
// contains filtered or unexported fields
}
used as a memfile working GoFile
func NewGoFile ¶
func NewGoFile(filename string) (*GoFile, io.WriteCloser, error)
NewGoFile returns a file object and an io.WriteCloser from a filename.
It checks for existance of the file and creates it as necessary. The returned file object is opened for writing only, and truncates any existing file. For append mode operations, use NewGoFileAppend().
Callers should use the io.WriteCloser for standard operations. The returned file object has buffering and additional capabilities for advanced operations.
func NewGoFileAppend ¶
func NewGoFileAppend(filename string) (*GoFile, io.WriteCloser, error)
NewGoFileAppend returns a file object and an io.WriteCloser from a filename.
It checks for existance of the file and creates it as necessary. The returned file object is opened for writing only, and is in append mode. For truncate mode operations, use NewGoFile().
Callers should use the io.WriteCloser for standard operations. The returned file object has buffering and additional capabilities for advanced operations.
func (*GoFile) DebugDetails ¶
func (f *GoFile) DebugDetails() []details
DebugDetails returns a list of interesting properties that we want to track during development and testing.
func (*GoFile) LoadData ¶
LoadData loads all data from the source file into the memfile in the *file struct.
func (*GoFile) PrintDebugDetails ¶
func (f *GoFile) PrintDebugDetails(detailSet []details)
type RWCPlus ¶
type RWCPlus interface { io.ReadWriteCloser io.Seeker io.StringWriter io.ByteWriter }