Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.

Static methods

staticinlinenewReadWriter(_r:Ref<Reader>, _w:Ref<Writer>):Ref<ReadWriter>

NewReadWriter allocates a new ReadWriter that dispatches to r and w.

staticinlinenewReader(_rd:Reader):Ref<Reader>

NewReader returns a new Reader whose buffer has the default size.

staticinlinenewReaderSize(_rd:Reader, _size:GoInt):Ref<Reader>

NewReaderSize returns a new Reader whose buffer has at least the specified size. If the argument io.Reader is already a Reader with large enough size, it returns the underlying Reader.

staticinlinenewScanner(_r:Reader):Ref<Scanner>

NewScanner returns a new Scanner to read from r. The split function defaults to ScanLines.

staticinlinenewWriter(_w:Writer):Ref<Writer>

NewWriter returns a new Writer whose buffer has the default size. If the argument io.Writer is already a Writer with large enough buffer size, it returns the underlying Writer.

staticinlinenewWriterSize(_w:Writer, _size:GoInt):Ref<Writer>

NewWriterSize returns a new Writer whose buffer has at least the specified size. If the argument io.Writer is already a Writer with large enough size, it returns the underlying Writer.

staticinlinescanBytes(_data:Slice<GoUInt8>, _atEOF:Bool):{_2:Error, _1:Slice<GoUInt8>, _0:GoInt}

ScanBytes is a split function for a Scanner that returns each byte as a token.

staticinlinescanLines(_data:Slice<GoUInt8>, _atEOF:Bool):{_2:Error, _1:Slice<GoUInt8>, _0:GoInt}

ScanLines is a split function for a Scanner that returns each line of text, stripped of any trailing end-of-line marker. The returned line may be empty. The end-of-line marker is one optional carriage return followed by one mandatory newline. In regular expression notation, it is \r?\n. The last non-empty line of input will be returned even if it has no newline.

staticinlinescanRunes(_data:Slice<GoUInt8>, _atEOF:Bool):{_2:Error, _1:Slice<GoUInt8>, _0:GoInt}

ScanRunes is a split function for a Scanner that returns each UTF-8-encoded rune as a token. The sequence of runes returned is equivalent to that from a range loop over the input as a string, which means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd". Because of the Scan interface, this makes it impossible for the client to distinguish correctly encoded replacement runes from encoding errors.

staticinlinescanWords(_data:Slice<GoUInt8>, _atEOF:Bool):{_2:Error, _1:Slice<GoUInt8>, _0:GoInt}

ScanWords is a split function for a Scanner that returns each space-separated word of text, with surrounding spaces deleted. It will never return an empty string. The definition of space is set by unicode.IsSpace.