summaryrefslogtreecommitdiff
path: root/src/lib/io/bytebuffer.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-05-14 17:03:47 -0700
committerRobert Griesemer <gri@golang.org>2009-05-14 17:03:47 -0700
commit91ec2c188dfa4cc2e60a6ab58de689b788fdc601 (patch)
tree0a1fdc258b384564abde8a0052ba2a133b3eb555 /src/lib/io/bytebuffer.go
parentc357d95aa02be8fe3b5eedfc00884f0bd1f9f287 (diff)
downloadgolang-91ec2c188dfa4cc2e60a6ab58de689b788fdc601.tar.gz
ByteBuffer.WriteByte
R=r DELTA=17 (10 added, 0 deleted, 7 changed) OCL=28860 CL=28862
Diffstat (limited to 'src/lib/io/bytebuffer.go')
-rw-r--r--src/lib/io/bytebuffer.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/io/bytebuffer.go b/src/lib/io/bytebuffer.go
index bc6a73741..5d4cd8add 100644
--- a/src/lib/io/bytebuffer.go
+++ b/src/lib/io/bytebuffer.go
@@ -74,6 +74,13 @@ func (b *ByteBuffer) Write(p []byte) (n int, err os.Error) {
return n, nil
}
+// WriteByte appends the byte c to the buffer.
+// Because Write never fails and WriteByte is not part of the
+// io.Writer interface, it does not need to return a value.
+func (b *ByteBuffer) WriteByte(c byte) {
+ b.Write([]byte{c});
+}
+
// Read reads the next len(p) bytes from the buffer or until the buffer
// is drained. The return value n is the number of bytes read; err is always nil.
func (b *ByteBuffer) Read(p []byte) (n int, err os.Error) {