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 ¶
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
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 ¶
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.