1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:44:39 -07:00

io: add ReadRuner

Put it in the same package as ReadByter.
There is no implementation here for either interface.

R=rsc
CC=golang-dev
https://golang.org/cl/4121051
This commit is contained in:
Rob Pike 2011-02-01 21:09:33 -08:00
parent 8a2d706487
commit 622d729b86

View File

@ -158,6 +158,15 @@ type ReadByter interface {
ReadByte() (c byte, err os.Error)
}
// ReadRuner is the interface that wraps the ReadRune method.
//
// ReadRune reads a single UTF-8 encoded Unicode character
// and returns the rune and its size in bytes. If no character is
// available, err will be set.
type ReadRuner interface {
ReadRune() (rune int, size int, err os.Error)
}
// WriteString writes the contents of the string s to w, which accepts an array of bytes.
func WriteString(w Writer, s string) (n int, err os.Error) {
return w.Write([]byte(s))