]> Cypherpunks repositories - gostls13.git/commitdiff
io: add ReadRuner
authorRob Pike <r@golang.org>
Wed, 2 Feb 2011 05:09:33 +0000 (21:09 -0800)
committerRob Pike <r@golang.org>
Wed, 2 Feb 2011 05:09:33 +0000 (21:09 -0800)
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

src/pkg/io/io.go

index 1a6eca95a0d9ab9536a842c67aa5c1ca9220d130..b88c213c81a416b521f6c507a92c04291e558bf2 100644 (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))