iobuf

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAll

func ReadAll(r io.Reader) ([]byte, error)

ReadAll reads all data from r and returns it as a byte slice. A successful call returns err == nil, not err == EOF. It does not treat an EOF as an error to be reported.

This function is similar to io.ReadAll, but uses a bytes.Buffer to accumulate the data, which has a more efficient growing algorithm and uses io.WriterTo if r implements it.

Example
r := strings.NewReader("The quick brown fox jumps over the lazy dog.")

b, err := ReadAll(r)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("%s", b)
Output:

The quick brown fox jumps over the lazy dog.

Types

This section is empty.

Jump to

Keyboard shortcuts

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