chunk

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const EOF = uint16(0x0000)

EOF is the end-of-file marker value for the size.

View Source
const MaxChunkSize = math.MaxUint16

MaxChunkSize is the largest allowable chunk size (64KB).

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader wraps a stream of chunks and converts it into an io.Reader. This is useful for byte streams where the size is not known beforehand.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader implements an io.Reader from a chunked byte stream.

func (*Reader) Read

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

type Writer

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

Writer wraps an io.Writer to convert it to a chunked byte stream. This is useful for byte streams where the size is not known beforehand.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter implements an io.Writer from a chunked byte stream.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the writer and writes out a closing EOF chunk.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Write writes p to the underlying writer with a chunk header.

Jump to

Keyboard shortcuts

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