summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/bytes/reader.go')
-rw-r--r--libgo/go/bytes/reader.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libgo/go/bytes/reader.go b/libgo/go/bytes/reader.go
index d2d40fa7ca1..b89d1548f1b 100644
--- a/libgo/go/bytes/reader.go
+++ b/libgo/go/bytes/reader.go
@@ -29,6 +29,12 @@ func (r *Reader) Len() int {
return int(int64(len(r.s)) - r.i)
}
+// Size returns the original length of the underlying byte slice.
+// Size is the number of bytes available for reading via ReadAt.
+// The returned value is always the same and is not affected by calls
+// to any other method.
+func (r *Reader) Size() int64 { return int64(len(r.s)) }
+
func (r *Reader) Read(b []byte) (n int, err error) {
if len(b) == 0 {
return 0, nil