summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-01-07 13:29:43 +1100
committerRob Pike <r@golang.org>2010-01-07 13:29:43 +1100
commit40260b3c29686d893fda4cc90bd0bda91118e36f (patch)
tree97c4b8f263b1e4f21156f96e2a7f243425b6dc45
parent3e08718a34fa22c08a4c9cb507817f9e08eaa288 (diff)
downloadgolang-40260b3c29686d893fda4cc90bd0bda91118e36f.tar.gz
add a standard interface that wraps ReadByte, io.ReadByter
R=rsc CC=golang-dev http://codereview.appspot.com/181163
-rw-r--r--src/pkg/io/io.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pkg/io/io.go b/src/pkg/io/io.go
index 5d18476f5..4357d5c6f 100644
--- a/src/pkg/io/io.go
+++ b/src/pkg/io/io.go
@@ -150,6 +150,14 @@ type WriterAt interface {
WriteAt(p []byte, off int64) (n int, err os.Error)
}
+// ReadByter is the interface that wraps the ReadByte method.
+//
+// ReadByte reads and returns the next byte from the input.
+// If no byte is available, err will be set.
+type ReadByter interface {
+ ReadByte() (c byte, 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(strings.Bytes(s))