diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
commit | adb0401dac41c81571722312d4586b2693f95aa6 (patch) | |
tree | ea2b52e3c258d6b6d9356977c683c7f72a4a5fd5 /libgo/go/io/ioutil/ioutil.go | |
parent | 5548ca3540bccbc908a45942896d635ea5f1c23f (diff) | |
download | gcc-adb0401dac41c81571722312d4586b2693f95aa6.tar.gz |
Update Go library to r60.
From-SVN: r178910
Diffstat (limited to 'libgo/go/io/ioutil/ioutil.go')
-rw-r--r-- | libgo/go/io/ioutil/ioutil.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libgo/go/io/ioutil/ioutil.go b/libgo/go/io/ioutil/ioutil.go index 5f1eecaabed..fffa1320f59 100644 --- a/libgo/go/io/ioutil/ioutil.go +++ b/libgo/go/io/ioutil/ioutil.go @@ -63,7 +63,7 @@ func WriteFile(filename string, data []byte, perm uint32) os.Error { return err } -// A dirList implements sort.Interface. +// A fileInfoList implements sort.Interface. type fileInfoList []*os.FileInfo func (f fileInfoList) Len() int { return len(f) } @@ -108,6 +108,23 @@ func (devNull) Write(p []byte) (int, os.Error) { return len(p), nil } +var blackHole = make([]byte, 8192) + +func (devNull) ReadFrom(r io.Reader) (n int64, err os.Error) { + readSize := 0 + for { + readSize, err = r.Read(blackHole) + n += int64(readSize) + if err != nil { + if err == os.EOF { + return n, nil + } + return + } + } + panic("unreachable") +} + // Discard is an io.Writer on which all Write calls succeed // without doing anything. var Discard io.Writer = devNull(0) |