Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 1 KB

README.md

File metadata and controls

22 lines (15 loc) · 1 KB

ringbuffer

License GoDoc travis Go Report Card coveralls

A circular buffer (ring buffer) in Go, implemented io.ReaderWriter interface

wikipedia

	rb := New(1024)

	// write
	rb.Write([]byte("abcd"))
	fmt.Println(rb.Length())
	fmt.Println(rb.Free())

	// read
	buf := make([]byte, 4)
	rb.Read(buf)
	fmt.Println(string(buf))