Documentation ¶
Overview ¶
The chanio package allows for using the io.Reader, io.Writer, and io.Closer interfaces to interact with byte channels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadWriteCloser ¶
type ReadWriteCloser chan byte
ReadWriteCloser implements the io.ReadWriteCloser interface.
func (ReadWriteCloser) Close ¶
func (r ReadWriteCloser) Close() error
Close closes w. It will never return a non-nil error.
func (ReadWriteCloser) Read ¶
func (r ReadWriteCloser) Read(p []byte) (int, error)
Read reads bytes from r into p, blocking until at least 1 byte is available. After that, it reads as many bytes into p as it can without blocking, or until p is full.
If r is closed, Read will return io.EOF. If there are any bytes available to be read from r, it will return those bytes and a nil error, and return io.EOF on the subsequent call.
If len(p) == 0, Read returns 0 and a nil error immediately.
type Reader ¶
type Reader <-chan byte
Reader implements the io.Reader interface.
func (Reader) Read ¶
Read reads bytes from r into p, blocking until at least 1 byte is available. After that, it reads as many bytes into p as it can without blocking, or until p is full.
If r is closed, Read will return io.EOF. If there are any bytes available to be read from r, it will return those bytes and a nil error, and return io.EOF on the subsequent call.
If len(p) == 0, Read returns 0 and a nil error immediately.
type WriteCloser ¶
type WriteCloser chan<- byte
WriteCloser implements the io.WriteCloser interface.
func (WriteCloser) Close ¶
func (w WriteCloser) Close() error
Close closes w. It will never return a non-nil error.