Documentation ¶
Index ¶
- func FprintfIfNotEmpty(w io.Writer, format, value string) (int, error)
- func HashData(src io.Reader) (string, error)
- func MultiReadSeeker(readers ...io.ReadSeeker) io.ReadSeeker
- func NewBufReader(r io.Reader) *bufReader
- func NewBufReaderWithDrainbufAndBuffer(r io.Reader, drainBuffer []byte, buffer *bytes.Buffer) *bufReader
- func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser
- func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader
- func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser
- func NopWriteCloser(w io.Writer) io.WriteCloser
- type NopFlusher
- type NopWriter
- type OnEOFReader
- type WriteCounter
- type WriteFlusher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FprintfIfNotEmpty ¶ added in v0.4.0
FprintfIfNotEmpty prints the string value if it's not empty
func MultiReadSeeker ¶ added in v0.4.0
func MultiReadSeeker(readers ...io.ReadSeeker) io.ReadSeeker
MultiReadSeeker returns a ReadSeeker that's the logical concatenation of the provided input readseekers. After calling this method the initial position is set to the beginning of the first ReadSeeker. At the end of a ReadSeeker, Read always advances to the beginning of the next ReadSeeker and returns EOF at the end of the last ReadSeeker. Seek can be used over the sum of lengths of all readseekers.
When a MultiReadSeeker is used, no Read and Seek operations should be made on its ReadSeeker components. Also, users should make no assumption on the state of individual readseekers while the MultiReadSeeker is used.
func NewBufReaderWithDrainbufAndBuffer ¶
func NewReadCloserWrapper ¶
func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser
func NewWriteCloserWrapper ¶
func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser
func NopWriteCloser ¶
func NopWriteCloser(w io.Writer) io.WriteCloser
Types ¶
type NopWriter ¶
type NopWriter struct{}
type OnEOFReader ¶ added in v0.4.0
type OnEOFReader struct { Rc io.ReadCloser Fn func() }
func (*OnEOFReader) Close ¶ added in v0.4.0
func (r *OnEOFReader) Close() error
func (*OnEOFReader) Read ¶ added in v0.4.0
func (r *OnEOFReader) Read(p []byte) (n int, err error)
type WriteCounter ¶ added in v0.3.1
Wrap a concrete io.Writer and hold a count of the number of bytes written to the writer during a "session". This can be convenient when write return is masked (e.g., json.Encoder.Encode())
func NewWriteCounter ¶ added in v0.3.1
func NewWriteCounter(w io.Writer) *WriteCounter
func (*WriteCounter) Write ¶ added in v0.3.1
func (wc *WriteCounter) Write(p []byte) (count int, err error)
type WriteFlusher ¶ added in v0.4.0
func NewWriteFlusher ¶ added in v0.4.0
func NewWriteFlusher(w io.Writer) *WriteFlusher
func (*WriteFlusher) Flush ¶ added in v0.4.0
func (wf *WriteFlusher) Flush()
Flush the stream immediately.
func (*WriteFlusher) Flushed ¶ added in v0.4.0
func (wf *WriteFlusher) Flushed() bool
func (*WriteFlusher) Write ¶ added in v0.4.0
func (wf *WriteFlusher) Write(b []byte) (n int, err error)