Standard library / bufio

bufio.Writer.Available()

Returns the unused capacity in the buffer, not the underlying destination capacity. Expected stdout: '6\n'.

Formal Syntax & Structure

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

Return Value

int

Returns the unused capacity in the buffer, not the underlying destination capacity.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "io")
func main() { w := bufio.NewWriterSize(io.Discard, 8); w.WriteString("ab"); fmt.Println(w.Available()) }
Go Reference