summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/gomega/gbytes/buffer.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/onsi/gomega/gbytes/buffer.go')
-rw-r--r--vendor/github.com/onsi/gomega/gbytes/buffer.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/github.com/onsi/gomega/gbytes/buffer.go b/vendor/github.com/onsi/gomega/gbytes/buffer.go
index 336086f4a..809f3c543 100644
--- a/vendor/github.com/onsi/gomega/gbytes/buffer.go
+++ b/vendor/github.com/onsi/gomega/gbytes/buffer.go
@@ -109,6 +109,22 @@ func (b *Buffer) Read(d []byte) (int, error) {
}
/*
+Clear clears out the buffer's contents
+*/
+func (b *Buffer) Clear() error {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+
+ if b.closed {
+ return errors.New("attempt to clear closed buffer")
+ }
+
+ b.contents = []byte{}
+ b.readCursor = 0
+ return nil
+}
+
+/*
Close signifies that the buffer will no longer be written to
*/
func (b *Buffer) Close() error {