incus-mirror/internal/io/bytesreadcloser.go
Stéphane Graber 67fbd327b6
internal/io: New package
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2023-09-28 04:33:33 -04:00

21 lines
352 B
Go

package io
import (
"bytes"
)
// BytesReadCloser is a basic in-memory reader with a closer interface.
type BytesReadCloser struct {
Buf *bytes.Buffer
}
// Read just returns the buffer.
func (r BytesReadCloser) Read(b []byte) (n int, err error) {
return r.Buf.Read(b)
}
// Close is a no-op.
func (r BytesReadCloser) Close() error {
return nil
}