τau /

bufio

module
bufio = import("bufio")

bufio - buffered reading and writing.

A reader here is what io calls a reader, anything with a Read(n): files, connections, buffers. Reading a line at a time straight from a file would mean one system call per byte, which is what this module is for.

NewReader = fn(r, size)source

NewReader wraps r so that it can be read a line or a byte at a time.

Read = fn(n)source

Read returns up to n bytes, from the buffer first.

ReadByte = fn()source

ReadByte returns the next byte as an integer, or null at end of input.

ReadLine = fn()source

ReadLine returns the next line without its newline, or null when there is nothing left. A last line without a newline is still a line.

ReadAll = fn()source

ReadAll returns everything left.

NewScanner = fn(r)source

NewScanner returns something to walk the lines of r with:

s = bufio.NewScanner(f)
for s.Scan() {
	println(s.Text())
}

Scan = fn()source

Scan reads the next line and reports whether there was one.

Text = fn()source

Bytes = fn()source

Err = fn()source

NewWriter = fn(w, size)source

NewWriter wraps w so that small writes are put together into big ones. Nothing reaches w until the buffer is full or Flush is called.

Flush = fn()source

Write = fn(data)source

WriteString = fn(s)source

WriteLine = fn(s)source