binary

package
v1.6.11 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package binary is a fork of the upstream golang library. The modifications made from the upstream source code are only related with the binary.read function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(r []byte, order binary.ByteOrder, data interface{}) error

Read reads structured binary data from r into data. Data must be a pointer to a fixed-size value or a slice of fixed-size values. Bytes read from r are decoded using the specified byte order and written to successive fields of the data. When decoding boolean values, a zero byte is decoded as false, and any other non-zero byte is decoded as true. When reading into structs, the field data for fields with blank (_) field names is skipped; i.e., blank field names may be used for padding. When reading into a struct, all non-blank fields must be exported or Read may panic.

The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, Read returns ErrUnexpectedEOF. This Read function differs from the upstream encoding/binary.Read as it does not requires the caller to setup a reader as well as this function does not allocate any memory to read from the given slice of bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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