pod

package
v0.0.0-...-205059d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pod provides types and functions for dealing with simple structured objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumeBytes

func ConsumeBytes(r Reader, bytes uint64) uint64

ConsumeBytes reads and throws away a number of bytes from r, returns the number of bytes it consumed

func ReadInt

func ReadInt(r Reader, bits int32) int64

ReadInt reads a signed integer of either 8, 16, 32 or 64 bits from r, returning the result as a int64.

func ReadUint

func ReadUint(r Reader, bits int32) uint64

ReadUint reads an unsigned integer of either 8, 16, 32 or 64 bits from r, returning the result as a uint64.

func WriteBytes

func WriteBytes(w Writer, v uint8, count int32)

WriteBytes writes the given v for count times to writer w.

func WriteInt

func WriteInt(w Writer, bits int32, v int64)

WriteInt writes the signed integer v of either 8, 16, 32 or 64 bits to w.

func WriteUint

func WriteUint(w Writer, bits int32, v uint64)

WriteUint writes the unsigned integer v of either 8, 16, 32 or 64 bits to w.

Types

type Readable

type Readable interface {
	// ReadSimple is invoked by a Reader to read the POD.
	ReadSimple(Reader)
}

Readable is the interface to things that readable as Plain Old Data.

type Reader

type Reader interface {
	// Data reads the data bytes in their entirety.
	Data([]byte)
	// Bool decodes and returns a boolean value from the Reader.
	Bool() bool
	// Int8 decodes and returns a signed, 8 bit integer value from the Reader.
	Int8() int8
	// Uint8 decodes and returns an unsigned, 8 bit integer value from the Reader.
	Uint8() uint8
	// Int16 decodes and returns a signed, 16 bit integer value from the Reader.
	Int16() int16
	// Uint16 decodes and returns an unsigned, 16 bit integer value from the Reader.
	Uint16() uint16
	// Int32 decodes and returns a signed, 32 bit integer value from the Reader.
	Int32() int32
	// Uint32 decodes and returns an unsigned, 32 bit integer value from the Reader.
	Uint32() uint32
	// Float16 decodes and returns a 16 bit floating-point value from the Reader.
	Float16() f16.Number
	// Float32 decodes and returns a 32 bit floating-point value from the Reader.
	Float32() float32
	// Int64 decodes and returns a signed, 64 bit integer value from the Reader.
	Int64() int64
	// Uint64 decodes and returns an unsigned, 64 bit integer value from the Reader.
	Uint64() uint64
	// Float64 decodes and returns a 64 bit floating-point value from the Reader.
	Float64() float64
	// String decodes and returns a string from the Reader.
	String() string
	// Simple decodes a Readable type from the Writer.
	Simple(Readable)
	// Decode a collection count from the stream.
	Count() uint32
	// If there is an error reading any input, all further reading returns the
	// zero value of the type read. Error() returns the error which stopped
	// reading from the stream. If reading has not stopped it returns nil.
	Error() error
	// Set the error state and stop reading from the stream.
	SetError(error)
}

Reader provides methods for decoding values.

type Writable

type Writable interface {
	// WriteSimple is invoked by a Writer to write the POD.
	WriteSimple(Writer)
}

Writable is the interface to things that are writable as Plain Old Data.

type Writer

type Writer interface {
	// Data writes the data bytes in their entirety.
	Data([]byte)
	// Bool encodes a boolean value to the Writer.
	Bool(bool)
	// Int8 encodes a signed, 8 bit integer value to the Writer.
	Int8(int8)
	// Uint8 encodes an unsigned, 8 bit integer value to the Writer.
	Uint8(uint8)
	// Int16 encodes a signed, 16 bit integer value to the Writer.
	Int16(int16)
	// Uint16 encodes an unsigned, 16 bit integer value to the Writer.
	Uint16(uint16)
	// Int32 encodes a signed, 32 bit integer value to the Writer.
	Int32(int32)
	// Uint32 encodes an usigned, 32 bit integer value to the Writer.
	Uint32(uint32)
	// Float16 encodes a 16 bit floating-point value to the Writer.
	Float16(f16.Number)
	// Float32 encodes a 32 bit floating-point value to the Writer.
	Float32(float32)
	// Int64 encodes a signed, 64 bit integer value to the Writer.
	Int64(int64)
	// Uint64 encodes an unsigned, 64 bit integer value to the Encoders's io.Writer.
	Uint64(uint64)
	// Float64 encodes a 64 bit floating-point value to the Writer.
	Float64(float64)
	// String encodes a string to the Writer.
	String(string)
	// Simple encodes a Writable type to the Writer.
	Simple(Writable)
	// If there is an error writing any output, all further writing becomes
	// a no-op. Error() returns the error which stopped writing to the stream.
	// If writing has not stopped it returns nil.
	Error() error
	// Set the error state and stop writing to the stream.
	SetError(error)
}

Writer provides methods for encoding values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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