func (w *Writer) Write(p []byte) (int, error) {
	n := copy(w.buf[:w.offset], p)
	w.offset += n
	return n, nil
}
Write implements io.Write for a Writer
package rw
type Writer struct {
	buf    []byte
	offset int
}
func NewWriter(p []byte) *Writer {
	return &Writer{buf: p, offset: 0}
}