io

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 3 Imported by: 0 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 io provides composite IO types that combine separate readers and writers into standard io.ReadWriter and io.ReadWriteCloser pairs, plus helpers for half-close and read-deadline propagation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupported is returned when a half-close operation is not supported
	// by the underlying reader or writer.
	ErrUnsupported = errors.New("unsupported")
)

Functions

func NewReadWriteCloser added in v0.0.3

func NewReadWriteCloser(r io.Reader, w io.Writer, c io.Closer) io.ReadWriteCloser

NewReadWriteCloser returns an io.ReadWriteCloser that reads from r, writes to w, and closes c. Close delegates to c. The returned value also supports CloseRead and CloseWrite by delegating to the corresponding methods on r or w when available.

func NewReadWriter

func NewReadWriter(r io.Reader, w io.Writer) io.ReadWriter

NewReadWriter returns an io.ReadWriter that reads from r and writes to w. The returned value supports CloseRead and CloseWrite by delegating to the corresponding methods on r or w when available.

func SetReadDeadline added in v0.0.3

func SetReadDeadline(rw io.ReadWriter, t time.Time) error

SetReadDeadline sets the read deadline on rw if the underlying connection supports it. It checks rw itself first, then unwraps *readWriter and *readWriteCloser to reach their embedded Reader or Writer. If no settable deadline is found the call is a no-op and returns nil.

Types

type CloseRead added in v0.0.3

type CloseRead interface {
	CloseRead() error
}

CloseRead is the interface that groups the basic CloseRead method.

CloseRead closes the read side of a connection. After CloseRead, reads return io.EOF while writes remain unaffected. It is typically implemented by net.TCPConn and connection wrappers throughout the x module.

type CloseWrite added in v0.0.3

type CloseWrite interface {
	CloseWrite() error
}

CloseWrite is the interface that groups the basic CloseWrite method.

CloseWrite closes the write side of a connection. After CloseWrite, writes return an error while reads continue to work. It is typically implemented by net.TCPConn and connection wrappers throughout the x module.

Jump to

Keyboard shortcuts

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