Documentation ¶
Overview ¶
Package ioutilh provides some helper functions and types to simplify working with ioutil package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDirEmpty ¶
IsDirEmpty checks if directory named by dirName is empty (has no child).
func Read ¶
Read perform ReadFull but with variable number of arguments. It stops if unable to fully read some of p. Read returns number of successfully read p's and error. It always returns nil error if EOF has been reached or if all p's have been read. Where is no way to check how many bytes have been read if not all p's have been read successfully.
func ReadDirNames ¶
ReadDirNames reads the directory named by dirName and returns list of directory entries. Result slice will be sorted if arrange is set to true.
func ReadFull ¶
ReadFull reads up to len(p) bytes into p. It is like io.Reader.Read but it tries to read full p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if ReadFull returns n < len(p), it may use all of p as scratch space during the call. If some data is available but less than len(p) bytes, ReadFull waits for more. ReadFull finished (on any of): - after len(p) bytes will be read (returns <len(p), nil> ), - if EOF will be reached (returns <n, nil> ), - on any other error (returns <n, err>). ReadFull does not return any error if len(p) bytes have been read. Warning: ReadFull can waste CPU because of io.Reader.Read may returns zero bytes even without error (depends on Reader implementation). In that case ReadFull will not block internally but will try to get new bytes in loop.
Types ¶
This section is empty.