Golang bufio.Buffered() function example
package bufio
Buffered returns the number of bytes that can be read from the current buffer.
Golang bufio.Buffered() function usage example
readbuffer := bytes.NewBuffer([]byte("12345678"))
read := bufio.NewReader(readbuffer)
fmt.Println(read.Buffered()) // print current buffer .. should print 0
var buf [4]byte // let's read 4 bytes
read.Read(buf[:])
fmt.Println(read.Buffered()) // should print 4
Advertisement
Something interesting
Tutorials
+10.6k Golang : Simple File Server
+17.9k Golang : Login and logout a user after password verification and redirect example
+6.9k Mac/Linux/Windows : Get CPU information from command line
+14.8k Golang : Find commonalities in two slices or arrays example
+7.3k Golang : File system scanning
+13.6k Golang : Set image canvas or background to transparent
+8.6k Golang : Progress bar with ∎ character
+5.2k Golang : Issue HTTP commands to server and port example
+11.6k Golang : Convert(cast) float to int
+6.6k Golang : Warp text string by number of characters or runes example
+9.6k Golang : Read file with ioutil