Пример #1
0
// WriteAt writes p at the current offset+off, wrapping at Cap()
func (wpr *Wrapper) WriteAt(p []byte, off int64) (n int, err error) {
	wrap := NewWrapWriter(wpr.rwa, wpr.O+off, wpr.N)
	w := limio.LimitWriter(wrap, wpr.N-off)
	n, err = w.Write(p)
	if wpr.L < off+int64(n) {
		wpr.L = int64(n) + off
	}
	return n, err
}
Пример #2
0
func (buf *memory) Write(p []byte) (n int, err error) {
	return limio.LimitWriter(buf.Buffer, Gap(buf)).Write(p)
}