Exemplo n.º 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
}
Exemplo n.º 2
0
Arquivo: mem.go Projeto: fd/buffer
func (buf *memory) Write(p []byte) (n int, err error) {
	return limio.LimitWriter(buf.Buffer, Gap(buf)).Write(p)
}