Documentation ¶
Index ¶
- Constants
- func BufReader(r io.Reader) *bufio.Reader
- func BufWriter(w io.Writer) *bufio.Writer
- func Filter(r io.Reader, w io.Writer, sync bool, filter LineFilterFunc) error
- func FilterRead(r io.Reader, filter func(int, []byte) error) error
- func NonEOF(err error) error
- func NopLineFilte(_ int, line []byte) ([]byte, error)
- func WriteIfString(w io.Writer, v interface{}) (bool, error)
- func WriteL(w io.Writer, bs ...[]byte) (n int, err error)
- func WriteLString(w io.Writer, strs ...string) (n int, err error)
- func WriteString(w io.Writer, s string) (int, error)
- func WriteStringln(w io.Writer, s string) (int, error)
- func Writeln(w io.Writer, bs []byte) (int, error)
- type ErrorReader
- type ErrorWriter
- type LineFilterFunc
- type WriterChain
Constants ¶
const FileBufferSIze = 4096
FileBufferSIze is the buffer size of slice to store file content
Variables ¶
This section is empty.
Functions ¶
func BufReader ¶
BufReader return a new bufio.Reader from exist io.Reader if current reader is already bufferd, return itself
func BufWriter ¶
BufWriter return a new bufio.Writer from exist io.Writer if current Writer is already bufferd, return itself
func Filter ¶
Filter readline from reader, after filter, if sync set at the end, and writer is non-null, write content to writer, otherwise, every read operation will followed by a write operation
return an error to stop filter, io.EOF means normal stop
func FilterRead ¶
FilterRead filter line from reader
func NopLineFilte ¶
NopLineFilter do nothing, just return the line
func WriteLString ¶
WriteL write a string list to writer, return total bytes writed
func WriteStringln ¶
WriteStringln write string to writer and append a newline character
Types ¶
type ErrorReader ¶
func NewErrorReader ¶
func NewErrorReader(r io.Reader) *ErrorReader
func (*ErrorReader) ClearError ¶
func (r *ErrorReader) ClearError()
type ErrorWriter ¶
func NewErrorWriter ¶
func NewErrorWriter(w io.Writer) *ErrorWriter
func (*ErrorWriter) ClearError ¶
func (w *ErrorWriter) ClearError()
func (*ErrorWriter) WriteDo ¶
func (w *ErrorWriter) WriteDo(data []byte, f func([]byte)) (int, error)
func (*ErrorWriter) WriteString ¶
func (w *ErrorWriter) WriteString(s string) (int, error)
type WriterChain ¶
type WriterChain interface { io.Writer // Wrap add a new writer to top of chain Wrap(io.Writer) // Unwrap remove writer from top of chain, if there is only the base writer // nil was returned Unwrap() io.Writer // IsWrapped check whether a chain has wrapped writer IsWrapped() bool // Writer return the top writer Writer() io.Writer // BaseWriter return the base writer BaseWriter() io.Writer }
func NewWriterChain ¶
func NewWriterChain(wr io.Writer) WriterChain
NewWriterChain create a new writer chain based on given writer parameter must not be nil, otherwise, nil was returned