recordioiov

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Overview

Package recordioiov provides utility functions for dealing with [][]bytes, used by recordio transformers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slice

func Slice(buf []byte, size int) []byte

Slice returns a byte slice of the given size. If cap(buf)>=size, then it returns buf[:size]. Else it allocates a new slice on heap.

func TotalBytes

func TotalBytes(buf [][]byte) int

TotalBytes returns the total size of the iovec.

Types

type IOVecReader

type IOVecReader struct {
	// contains filtered or unexported fields
}

IOVecReader is an io.Reader adapter for [][]byte.

func NewIOVecReader

func NewIOVecReader(buf [][]byte) IOVecReader

NewIOVecReader creates a new io.Reader that reads from the given buf.

func (*IOVecReader) Read

func (r *IOVecReader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

func (*IOVecReader) ReadByte

func (r *IOVecReader) ReadByte() (byte, error)

ReadByte reads one byte from the reader. On EOF, returns (0, io.EOF).

Jump to

Keyboard shortcuts

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