Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStreamTooLarge = errors.New("stream too large")
ErrStreamTooLarge is returned by LimitReadCloser when the stream is too large.
Functions ¶
func LimitReadCloser ¶
func LimitReadCloser(r io.ReadCloser, n int64) io.ReadCloser
LimitReadCloser returns a ReadCloser that reads from r but stops with ErrStreamTooLarge after n bytes.
func RuneToUppercase ¶
RuneToUppercase converts a rune into a byte slice where all lowercase letters (Unicode-aware) are converted to uppercase ones.
Types ¶
type MultiReaderCloser ¶
type MultiReaderCloser struct {
// contains filtered or unexported fields
}
MultiReaderCloser is an io.MultiReader that also implements the io.Closer interface to close the readable streams. Readable streams are also closed when we're done reading from them.
func NewMultiReaderCloser ¶
func NewMultiReaderCloser(readers ...io.Reader) *MultiReaderCloser
NewMultiReaderCloser returns a stream that is like io.MultiReader but that can be closed. When the returned stream is closed, it closes the readable streams too, if they implement io.Closer.
func (*MultiReaderCloser) Close ¶
func (mr *MultiReaderCloser) Close() error
Close implements io.Closer.
type TeeReadCloser ¶
type TeeReadCloser struct {
// contains filtered or unexported fields
}
TeeReadCloser is an io.TeeReader that also implements the io.Closer interface to close the readable stream.
func NewTeeReadCloser ¶
func NewTeeReadCloser(r io.Reader, w io.Writer) *TeeReadCloser
NewTeeReadCloser returns a stream that is like io.TeeReader but that can be closed. When the returned stream is closed, it closes the readable stream too, if it implements io.Closer.
func (*TeeReadCloser) Read ¶
func (t *TeeReadCloser) Read(p []byte) (n int, err error)
Read from the R stream and tee it into the w stream.
func (*TeeReadCloser) Stop ¶
func (t *TeeReadCloser) Stop() (err error)
Stop closes the underlying writer, which will blocks all future read operations with ErrClosedPipe, but doesn't close the reader stream. It's meant to be used when the reader needs to be swapped.