Documentation
¶
Overview ¶
Package stream provides I/O stream utilities
Index ¶
- Constants
- func LineInput(r *bufio.Reader) (ale.Value, bool)
- func NewChannel(size int) *data.Object
- func NewChannelSequence(ch <-chan ale.Value) data.Sequence
- func NewReader(r io.Reader, i InputFunc) data.Sequence
- func NewWriter(w io.Writer, o OutputFunc) *data.Object
- func RuneInput(r *bufio.Reader) (ale.Value, bool)
- func StrOutput(w *bufio.Writer, v ale.Value)
- func WrapFileSystem(fs fs.FS) *data.Object
- type InputFunc
- type OutputFunc
- type Writer
Constants ¶
View Source
const ( ListKey = data.Keyword("list") Dir = data.Keyword("dir") File = data.Keyword("file") OpenKey = data.Keyword("open") ReadString = data.Keyword("read-string") // String ReadLines = data.Keyword("read-lines") // String ReadAll = data.Keyword("read-all") // Bytes ReadBlocks = data.Keyword("read-blocks") // Bytes )
View Source
const ( ErrExpectedDirectory = "expected a directory, got a file: %s" ErrUnknownOpenMode = "unknown open mode: %s" ErrExpectedFile = "expected a file, got a directory: %s" ErrUnexpectedArguments = "unexpected additional arguments: %s" )
View Source
const ( // WriteKey is key used to write to a Writer WriteKey = data.Keyword("write") // CloseKey is the key used to close a file CloseKey = data.Keyword("close") // EmitKey is the key used to emit to a Channel EmitKey = data.Keyword("emit") // SequenceKey is the key used to retrieve the Sequence from a Channel SequenceKey = data.Keyword("seq") )
View Source
const (
ErrInvalidBlockSize = "block size must be greater than zero: %d"
)
Variables ¶
This section is empty.
Functions ¶
func NewChannel ¶
NewChannel produces an Emitter and Sequence pair
func NewChannelSequence ¶
NewChannelSequence produces a new Sequence whose values come from a Go chan
func NewWriter ¶
func NewWriter(w io.Writer, o OutputFunc) *data.Object
NewWriter wraps a Go Writer, coupling it with an output function
Types ¶
type InputFunc ¶
InputFunc is a callback used to unmarshal values from a Reader
func BlockInput ¶ added in v0.3.0
BlockInput creates an InputFunc that reads up to a fixed number of bytes from the Reader.
type OutputFunc ¶
OutputFunc is a callback used to marshal values to a Writer
Click to show internal directories.
Click to hide internal directories.