diff options
author | Rob Pike <r@golang.org> | 2009-04-19 21:02:29 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-04-19 21:02:29 -0700 |
commit | 90bffe62a9ceb5828e83b97b87db1cf52e87a9ee (patch) | |
tree | 1b5c73c89b144a1dcf29333bd896fa1e15704e86 /src/lib/io/io.go | |
parent | bb20702e5106e1ffea9a34629367312cc43acef7 (diff) | |
download | golang-90bffe62a9ceb5828e83b97b87db1cf52e87a9ee.tar.gz |
Readn is a silly name when there's no n. Change to FullRead.
R=gri
DELTA=15 (0 added, 0 deleted, 15 changed)
OCL=27619
CL=27619
Diffstat (limited to 'src/lib/io/io.go')
-rw-r--r-- | src/lib/io/io.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/io/io.go b/src/lib/io/io.go index 2c116687b..5036e326a 100644 --- a/src/lib/io/io.go +++ b/src/lib/io/io.go @@ -13,7 +13,7 @@ import ( "os"; ) -// ErrEOF is the error returned by Readn and Copyn when they encounter EOF. +// ErrEOF is the error returned by FullRead and Copyn when they encounter EOF. var ErrEOF = os.NewError("EOF") // Read is the interface that wraps the basic Read method. @@ -70,8 +70,8 @@ func WriteString(w Write, s string) (n int, err os.Error) { return w.Write(StringBytes(s)) } -// Readn reads r until the buffer buf is full, or until EOF or error. -func Readn(r Read, buf []byte) (n int, err os.Error) { +// FullRead reads r until the buffer buf is full, or until EOF or error. +func FullRead(r Read, buf []byte) (n int, err os.Error) { n = 0; for n < len(buf) { nn, e := r.Read(buf[n:len(buf)]); @@ -89,18 +89,18 @@ func Readn(r Read, buf []byte) (n int, err os.Error) { } // Convert something that implements Read into something -// whose Reads are always Readn +// whose Reads are always FullReads type fullRead struct { r Read; } func (fr *fullRead) Read(p []byte) (n int, err os.Error) { - n, err = Readn(fr.r, p); + n, err = FullRead(fr.r, p); return n, err } // MakeFullReader takes r, an implementation of Read, and returns an object -// that still implements Read but always calls Readn underneath. +// that still implements Read but always calls FullRead underneath. func MakeFullReader(r Read) Read { if fr, ok := r.(*fullRead); ok { // already a fullRead |