Documentation
¶
Index ¶
- func BytesToReadCloser(b []byte) io.ReadCloser
- func CopyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error)
- func CopyEx(dst io.Writer, dstWriteCb SetDeadlineCallback, src io.Reader, ...) (written int64, err error)
- func CopyStream(dst io.Writer, src io.ReadCloser) chan struct{}
- func CopyTimeout(dst io.Writer, src io.Reader, noDataTimeout time.Duration) (written int64, err error)
- func ReadAtLeast(r io.Reader, buf []byte, min int, timeout *time.Duration) (n int, err error)
- func ReadCloserToBytes(rd io.ReadCloser) ([]byte, error)
- func ReadCloserToInterface(rd io.ReadCloser) (interface{}, error)
- func ReadCloserToString(rd io.ReadCloser) (string, error)
- func ReadFull(r io.Reader, buf []byte, timeout *time.Duration) (n int, err error)
- func ReaderToBytes(rd io.Reader) ([]byte, error)
- func ReaderToString(rd io.Reader) (string, error)
- func StringToReadCloser(s string) io.ReadCloser
- func TwoWayCopy(s1, s2 io.ReadWriteCloser, errNotify ErrNotify)
- type CopiedSizeCallback
- type ErrNotify
- type Flusher
- type SetDeadlineCallback
- type TimeoutR
- type TimeoutReadCloser
- type TimeoutReadWriteCloser
- type TimeoutW
- type TimeoutWriteCloser
- type WriteFlusher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToReadCloser ¶
func BytesToReadCloser(b []byte) io.ReadCloser
func CopyBuffer ¶
https://github.com/xtaci/kcptun/blob/master/server/main.go io.CopyBuffer has extra tests for interface like io.ReaderFrom and io.WriterTo which is not efficient in memory management from tests
func CopyEx ¶
func CopyEx(dst io.Writer, dstWriteCb SetDeadlineCallback, src io.Reader, srcReadCb SetDeadlineCallback, timeout time.Duration, sizeCallback CopiedSizeCallback) (written int64, err error)
https://github.com/efarrer/iothrottler/ https://github.com/jwkohnen/bwio/ limit copy speed / duration, read copied size
func CopyStream ¶
func CopyStream(dst io.Writer, src io.ReadCloser) chan struct{}
func CopyTimeout ¶
func CopyTimeout(dst io.Writer, src io.Reader, noDataTimeout time.Duration) (written int64, err error)
CopyTimeout is a Copy function with no data timeout parameter. Note: among the two, 'dst' and 'src', there must be at least one net.Conn More: https://groups.google.com/g/golang-nuts/c/byfD0YtIl0I
func ReadAtLeast ¶
ReadAtLeast is based on standard io library.
func ReadCloserToBytes ¶
func ReadCloserToBytes(rd io.ReadCloser) ([]byte, error)
func ReadCloserToInterface ¶
func ReadCloserToInterface(rd io.ReadCloser) (interface{}, error)
func ReadCloserToString ¶
func ReadCloserToString(rd io.ReadCloser) (string, error)
func StringToReadCloser ¶
func StringToReadCloser(s string) io.ReadCloser
func TwoWayCopy ¶
func TwoWayCopy(s1, s2 io.ReadWriteCloser, errNotify ErrNotify)
Types ¶
type CopiedSizeCallback ¶
type CopiedSizeCallback func(size int64)
type SetDeadlineCallback ¶
type TimeoutReadCloser ¶
type TimeoutReadCloser interface { io.ReadCloser SetReadDeadline(t time.Time) error }
func WrapTimeoutReader ¶
func WrapTimeoutReader(r io.ReadCloser) TimeoutReadCloser
type TimeoutReadWriteCloser ¶
type TimeoutWriteCloser ¶
type TimeoutWriteCloser interface { io.WriteCloser SetWriteDeadline(t time.Time) error }
func WrapTimeoutWriter ¶
func WrapTimeoutWriter(w io.WriteCloser) TimeoutWriteCloser
type WriteFlusher ¶
Click to show internal directories.
Click to hide internal directories.