41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
package iox
|
|
|
|
import (
|
|
`io`
|
|
)
|
|
|
|
// Copy copies [io.Reader] `src` to [io.Writer] `dst`. It implements [Copier].
|
|
func (x *XIO) Copy(dst io.Writer, src io.Reader) (written int64, err error) {
|
|
return io.Copy(dst, src)
|
|
}
|
|
|
|
// CopyBuffer copies [io.Reader] `src` to [io.Writer] `dst` using buffer `buf`. It implements [CopyBufferer].
|
|
func (x *XIO) CopyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error) {
|
|
return io.CopyBuffer(dst, src, buf)
|
|
}
|
|
|
|
// CopyBufWith copies [io.Reader] `src` to [io.Writer] `dst` using buffer returner `bufFunc`. It implements [SizedCopyBufferInvoker].
|
|
func (x *XIO) CopyBufWith(dst io.Writer, src io.Reader, bufFunc func() (b []byte)) (written int64, err error) {
|
|
return CopyBufWith(dst, src, bufFunc)
|
|
}
|
|
|
|
// CopyBufWithDynamic copies [io.Reader] `src` to [io.Writer] `dst` using buffer returner `bufFunc` for each chunk. It implements [DynamicSizedCopyBufferInvoker].
|
|
func (x *XIO) CopyBufWithDynamic(dst io.Writer, src io.Reader, bufFunc func() (b []byte)) (written int64, err error) {
|
|
return CopyBufWithDynamic(dst, src, bufFunc)
|
|
}
|
|
|
|
/*
|
|
CopyBufN reads buffered bytes from [io.Reader] `src` and copies to [io.Writer] `dst`
|
|
using the synchronous buffer size `n`.
|
|
|
|
It implements [SizedCopyBufferer].
|
|
*/
|
|
func (x *XIO) CopyBufN(dst io.Writer, src io.Reader, n int64) (written int64, err error) {
|
|
return CopyBufN(dst, src, n)
|
|
}
|
|
|
|
// CopyN copies from [io.Reader] `src` to [io.Writer] `w`, `n` bytes at a time. It implements [SizedCopier].
|
|
func (x *XIO) CopyN(dst io.Writer, src io.Reader, n int64) (written int64, err error) {
|
|
return io.CopyN(dst, src, n)
|
|
}
|