Standard library / bytes

bytes.Buffer.Available()

Reports unused capacity at the end of the buffer storage. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Buffer) Available() int

Return Value

int

Reports unused capacity at the end of the buffer storage.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  var b bytes.Buffer  b.Grow(8)  fmt.Println(b.Available() >= 8)}
Go Reference