iox

package
Version: v0.0.0-...-d76c0ac Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("closed")

ErrClosed is the error returned by Stdio.Accept if it has been closed.

TODO use net.ErrClosed when support for 1.15 is dropped.

Functions

func NewStdio

func NewStdio() net.Listener

NewStdio returns a new Stdio listener.

Types

type ReaderFunc

type ReaderFunc func([]byte) (int, error)

ReaderFunc is an io.Reader function.

func (ReaderFunc) Read

func (f ReaderFunc) Read(b []byte) (int, error)

Read implements io.Reader.

type Stdio

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

Stdio is a net.Listener that produces StdioConns.

func (*Stdio) Accept

func (s *Stdio) Accept() (net.Conn, error)

Accept returns a StdioConn, blocking until any previous StdioConn has been closed.

func (*Stdio) Addr

func (s *Stdio) Addr() net.Addr

Addr returns a StdioAddr.

func (*Stdio) Close

func (s *Stdio) Close() error

Close closes the listener.

type StdioAddr

type StdioAddr int

StdioAddr implements net.Addr.

func (StdioAddr) Network

func (StdioAddr) Network() string

Network returns "stdio".

func (StdioAddr) String

func (a StdioAddr) String() string

String implements net.Addr.

type StdioConn

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

StdioConn is a net.Conn that reads stdin and writes stdout.

func (*StdioConn) Close

func (c *StdioConn) Close() error

Close releases the StdioConn.

func (*StdioConn) LocalAddr

func (c *StdioConn) LocalAddr() net.Addr

LocalAddr implements net.Conn.

func (*StdioConn) Read

func (c *StdioConn) Read(b []byte) (int, error)

Read reads from stdin.

func (*StdioConn) RemoteAddr

func (c *StdioConn) RemoteAddr() net.Addr

RemoteAddr implements net.Conn.

func (*StdioConn) SetDeadline

func (c *StdioConn) SetDeadline(t time.Time) error

SetDeadline sets a read deadline and a write deadline on stdin and stdout, respectively.

func (*StdioConn) SetReadDeadline

func (c *StdioConn) SetReadDeadline(t time.Time) error

SetReadDeadline sets a read deadline on stdin.

func (*StdioConn) SetWriteDeadline

func (c *StdioConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets a write deadline on stdout.

func (*StdioConn) Write

func (c *StdioConn) Write(b []byte) (int, error)

Write writes to stdout.

type WriterFunc

type WriterFunc func([]byte) (int, error)

WriterFunc is an io.Writer function.

func (WriterFunc) Write

func (f WriterFunc) Write(b []byte) (int, error)

Write implements io.Writer.

Source Files

Jump to

Keyboard shortcuts

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