beam: github.com/apache/beam/sdks/go/pkg/beam/core/util/ioutilx Index | Files

package ioutilx

import "github.com/apache/beam/sdks/go/pkg/beam/core/util/ioutilx"

Package ioutilx contains additional io utilities.

Index

Package Files

read.go write.go

func ReadN Uses

func ReadN(r io.Reader, n int) ([]byte, error)

ReadN reads exactly N bytes from the reader. Fails otherwise.

func ReadNBufUnsafe Uses

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

ReadNBufUnsafe reads exactly cap(buf) bytes from the reader. Fails otherwise. Uses the unsafe package unsafely to convince escape analysis that the passed in []byte doesn't escape this function through the io.Reader. Intended for use with small, fixed sized, stack allocated buffers that have no business being allocated to the heap. If the io.Reader somehow retains the passed in []byte, then this should not be used, and ReadN preferred.

func ReadUnsafe Uses

func ReadUnsafe(r io.Reader, b []byte) (int, error)

ReadUnsafe is an unsafe version of read that breaks escape analysis to allow the passed in []byte to be allocated to the stack. Intended for use with small, fixed sized, stack allocated buffers that have no business being allocated to the heap. If the io.Reader somehow retains the passed in []byte, then this should not be used, and ReadN preferred.

func WriteUnsafe Uses

func WriteUnsafe(w io.Writer, b []byte) (int, error)

WriteUnsafe writes the buffer to the given writer, but breaks escape analysis so that the passed in []byte can be allocated to the stack. Use with caution, and only when you're certain the writer doesn't retain the passed in byte buffer.

Package ioutilx imports 3 packages (graph) and is imported by 3 packages. Updated 2019-05-31. Refresh now. Tools for package owners.