io

package
v0.0.0-...-3d82958 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {

	// Read implements io.Reader
	Read(buff []byte) (n int, err error)

	// Next returns the next n bytes when the connection data is ready, and returns the original buffer.
	Next(n int) (buf []byte, err error)

	// Peek returns the next n bytes but not advancing the reader.
	Peek(n int) (buf []byte, err error)

	// Skip skips the next n bytes.
	Skip(n int) (err error)

	Length() int

	// Release releases the memory space occupied by all read slices.
	Release()
}

Reader an abstraction to read data from transport.Connection.

All read operations are implemented as blocking. The return value is guaranteed to meet the requirements or an error will be returned.

type Writer

type Writer interface {

	// Write writes bytes to buffer directly.
	Write(buf []byte) (n int, err error)

	// Malloc returns the next n bytes slice from the buffer.
	Malloc(n int) (buf []byte, err error)

	// MallocLength returns the total length of the written data that has not yet been submitted in the writer.
	MallocLength() (length int)

	// Flush submits all written data to raw connection.
	Flush() (err error)

	// Release the memory space occupied by all write slices.
	Release()
}

Writer is an abstraction to write data to transport.Connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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