Files
go_goutils/iox/funcs_xio.go
brent saner 145c32268e v1.14.0
ADDED:
* iox package
* mapsx package
* netx/inetcksum package
2025-12-18 04:47:31 -05:00

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)
}