astiio

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 4 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, src io.Reader, dst io.Writer) (int64, error)

Copy represents a cancellable copy

Types

type Linearizer

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

Linearizer represents an object capable of linearizing data coming from an io.Reader as packets

func NewLinearizer

func NewLinearizer(ctx context.Context, r io.Reader, readSize, bufferSize int) (l *Linearizer)

NewLinearizer creates a new linearizer that will read readSize bytes at each iteration, write it in its internal buffer capped at bufferSize bytes and allow reading this linearized data.

func (*Linearizer) Close

func (l *Linearizer) Close() error

Close implements the io.Closer interface

func (*Linearizer) Read

func (l *Linearizer) Read(b []byte) (n int, err error)

Read implements the io.Reader interface

func (*Linearizer) Start

func (l *Linearizer) Start()

Start reads the reader and dispatches events accordingly

type Reader

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

Reader represents a reader with a context

func NewReader

func NewReader(ctx context.Context, r io.Reader) *Reader

NewReader creates a new Reader

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read allows Reader to implement the io.Reader interface

Jump to

Keyboard shortcuts

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