refactor: Start implementation of public API

This commit is contained in:
Felix Pojtinger
2021-12-06 21:01:41 +01:00
parent e611622199
commit 3efa2fe308
45 changed files with 211 additions and 54 deletions
+31
View File
@@ -0,0 +1,31 @@
package counters
import "io"
type CounterReader struct {
Reader io.Reader
BytesRead int
}
func (r *CounterReader) Read(p []byte) (n int, err error) {
n, err = r.Reader.Read(p)
r.BytesRead += n
return n, err
}
type CounterWriter struct {
Writer io.Writer
BytesRead int
}
func (w *CounterWriter) Write(p []byte) (n int, err error) {
n, err = w.Writer.Write(p)
w.BytesRead += n
return n, err
}