Chromium Code Reviews| Index: common/iotools/countingreader.go |
| diff --git a/common/iotools/countingreader.go b/common/iotools/countingreader.go |
| index ec807e45403a6304be2793fc27c0d7f3e6c70787..8c0f1b1396516eb48fb2a4a7e2e560d03f48bfbe 100644 |
| --- a/common/iotools/countingreader.go |
| +++ b/common/iotools/countingreader.go |
| @@ -12,7 +12,7 @@ import ( |
| type CountingReader struct { |
| io.Reader // The underlying io.Reader. |
| - count int64 |
| + Count int64 |
|
dnj
2016/10/19 23:18:59
This is trivial enough that I don't mind combining
|
| } |
| var _ io.Reader = (*CountingReader)(nil) |
| @@ -20,7 +20,7 @@ var _ io.Reader = (*CountingReader)(nil) |
| // Read implements io.Reader. |
| func (c *CountingReader) Read(buf []byte) (int, error) { |
| amount, err := c.Reader.Read(buf) |
| - c.count += int64(amount) |
| + c.Count += int64(amount) |
| return amount, err |
| } |
| @@ -30,7 +30,7 @@ func (c *CountingReader) ReadByte() (byte, error) { |
| if br, ok := c.Reader.(io.ByteReader); ok { |
| b, err := br.ReadByte() |
| if err == nil { |
| - c.count++ |
| + c.Count++ |
| } |
| return b, err |
| } |
| @@ -38,13 +38,8 @@ func (c *CountingReader) ReadByte() (byte, error) { |
| data := []byte{0} |
| amount, err := c.Reader.Read(data) |
| if amount != 0 { |
| - c.count += int64(amount) |
| + c.Count += int64(amount) |
| return data[0], err |
| } |
| return 0, err |
| } |
| - |
| -// Count returns the number of bytes that have been read. |
| -func (c *CountingReader) Count() int64 { |
| - return c.count |
| -} |