bufio

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package bufio provides a buffered reader and writer that propagate calls to Flush and Close.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

Reader is a modified version of the Reader from the standard library bufio package that wraps an io.ReadCloser and closes its underlying closer when the Close method is called.

func NewReader

func NewReader(r io.ReadCloser) *Reader

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

func NewReaderSize

func NewReaderSize(r io.ReadCloser, size int) *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.

func NewReaderSizeClose

func NewReaderSizeClose(r io.ReadCloser, size int, close bool) *Reader

NewReaderSizeClose 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.

func (*Reader) Close

func (b *Reader) Close() error

Close closes the underlying io.ReadCloser.

func (*Reader) Reset

func (b *Reader) Reset(r io.ReadCloser)

type Scanner

type Scanner struct {
	*bufio.Scanner
	// contains filtered or unexported fields
}

Scanner is a modified version of the Scanner from the standard library bufio package that wraps an io.ReadCloser and closes its underlying closer when the Close method is called.

func NewScanner

func NewScanner(r io.ReadCloser) *Scanner

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

func (*Scanner) Close

func (s *Scanner) Close() error

Close closes the underlying io.ReadCloser.

type Writer

type Writer struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer whose buffer has the default size.

func NewWriterClose

func NewWriterClose(w io.Writer, close bool) *Writer

NewWriterClose returns a new Writer whose buffer has the default size. If close is false, then does not close the underlying writer.

func NewWriterSize

func NewWriterSize(w io.Writer, size int) *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.

func NewWriterSizeClose

func NewWriterSizeClose(w io.Writer, size int, close bool) *Writer

NewWriterSizeClose 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.

func (*Writer) Close

func (b *Writer) Close() error

Close calls the "Close() error" method of the underlying writer, if it implements io.Closer.

func (*Writer) Flush

func (b *Writer) Flush() error

Flush writes any buffered data to the underlying io.Writer. Then calls the "Flush() error" method of the underlying writer, if it implements it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL