From 21e406c40350bd16a3b3111356392ed1f70b1d57 Mon Sep 17 00:00:00 2001 From: Albert Date: Mon, 27 Jun 2016 17:59:55 +0500 Subject: [PATCH] Add WriteByte function (#2) --- bytebuffer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bytebuffer.go b/bytebuffer.go index f7ce7bf..967cb76 100644 --- a/bytebuffer.go +++ b/bytebuffer.go @@ -20,6 +20,13 @@ func (b *ByteBuffer) Write(p []byte) (int, error) { return len(p), nil } +// WriteByte appends the byte c to the buffer. +// The returned error is always nil. +func (b *ByteBuffer) WriteByte(c byte) error { + b.B = append(b.B, c) + return nil +} + // WriteString appends s to ByteBuffer.B func (b *ByteBuffer) WriteString(s string) (int, error) { b.B = append(b.B, s...)