2019-09-06 01:28:37 +00:00
|
|
|
# go-buffers
|
|
|
|
|
2023-10-25 21:08:25 +00:00
|
|
|
Package **buffers** provides tools for working with byte array, and byte slice buffers, for the Go programming language.
|
2019-09-06 01:28:37 +00:00
|
|
|
|
|
|
|
## Documention
|
|
|
|
|
2023-10-25 21:07:03 +00:00
|
|
|
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-buffers
|
2019-09-06 01:28:37 +00:00
|
|
|
|
2023-10-25 21:07:03 +00:00
|
|
|
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-buffers?status.svg)](https://godoc.org/sourcecode.social/reiver/go-buffers)
|
2019-09-06 01:28:37 +00:00
|
|
|
|
|
|
|
## Example
|
|
|
|
```go
|
2023-10-25 21:07:03 +00:00
|
|
|
import "sourcecode.social/reiver/go-buffers"
|
2019-09-06 01:28:37 +00:00
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
var buffer [1024]byte
|
|
|
|
|
|
|
|
var p []byte = buffer[:]
|
|
|
|
|
|
|
|
writer := buffers.NewWriter(p)
|
|
|
|
|
|
|
|
n, err := writer.Write(data)
|
|
|
|
|
|
|
|
switch casted := err.(type) {
|
|
|
|
case buffers.TooShort:
|
|
|
|
//@TODO
|
|
|
|
default:
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|