go2hx

manual

github

Module: stdgo.io

(view library index)

Overview

Index

Constants

import stdgo.io.Io
final seekCurrent:haxe.UInt64 = stdgo._internal.io.Io_seekCurrent.seekCurrent
final seekEnd:haxe.UInt64 = stdgo._internal.io.Io_seekEnd.seekEnd
final seekStart:haxe.UInt64 = stdgo._internal.io.Io_seekStart.seekStart

Variables

import stdgo.io.Io
var discard:stdgo.io.Writer
var eof:stdgo.Error
var errClosedPipe:stdgo.Error
var errInvalidWrite:stdgo.Error
var errNoProgress:stdgo.Error
var errOffset:stdgo.Error
var errShortBuffer:stdgo.Error
var errShortWrite:stdgo.Error
var errUnexpectedEOF:stdgo.Error
var errWhence:stdgo.Error

Classes

import stdgo.io.*

class Io

Package io provides basic interfaces to I/O primitives.
    Its primary job is to wrap existing implementations of such primitives,
    such as those in package os, into shared public interfaces that
    abstract the functionality, plus some other related primitives.

Because these interfaces and primitives wrap lower-level operations with various implementations, unless otherwise informed clients should not assume they are safe for parallel execution.

Io function copy

function copy(_dst:stdgo.io.Writer, _src:stdgo.io.Reader):stdgo.Tuple<haxe.Int64, stdgo.Error>
Copy copies from src to dst until either EOF is reached
        on src or an error occurs. It returns the number of bytes
        copied and the first error encountered while copying, if any.

A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.

If src implements the WriterTo interface, the copy is implemented by calling src.WriteTo(dst). Otherwise, if dst implements the ReaderFrom interface, the copy is implemented by calling dst.ReadFrom(src).

(view code)

Io function copyBuffer

function copyBuffer(_dst:stdgo.io.Writer, _src:stdgo.io.Reader, _buf:Array<UInt>):stdgo.Tuple<haxe.Int64, stdgo.Error>
CopyBuffer is identical to Copy except that it stages through the
        provided buffer (if one is required) rather than allocating a
        temporary one. If buf is nil, one is allocated; otherwise if it has
        zero length, CopyBuffer panics.

If either src implements WriterTo or dst implements ReaderFrom, buf will not be used to perform the copy.

(view code)

Io function copyN

function copyN(_dst:stdgo.io.Writer, _src:stdgo.io.Reader, _n:haxe.Int64):stdgo.Tuple<haxe.Int64, stdgo.Error>
CopyN copies n bytes (or until an error) from src to dst.
        It returns the number of bytes copied and the earliest
        error encountered while copying.
        On return, written == n if and only if err == nil.

If dst implements the ReaderFrom interface, the copy is implemented using it.

(view code)

Io function limitReader

function limitReader(_r:stdgo.io.Reader, _n:haxe.Int64):stdgo.io.Reader
LimitReader returns a Reader that reads from r
        but stops with EOF after n bytes.
        The underlying implementation is a *LimitedReader.

(view code)

Io function multiReader

function multiReader(_readers:haxe.Rest<stdgo.io.Reader>):stdgo.io.Reader
MultiReader returns a Reader that's the logical concatenation of
        the provided input readers. They're read sequentially. Once all
        inputs have returned EOF, Read will return EOF.  If any of the readers
        return a non-nil, non-EOF error, Read will return that error.

(view code)

Io function multiWriter

function multiWriter(_writers:haxe.Rest<stdgo.io.Writer>):stdgo.io.Writer
MultiWriter creates a writer that duplicates its writes to all the
        provided writers, similar to the Unix tee(1) command.

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

(view code)

Io function newOffsetWriter

function newOffsetWriter(_w:stdgo.io.WriterAt, _off:haxe.Int64):stdgo.io.OffsetWriter
NewOffsetWriter returns an OffsetWriter that writes to w
        starting at offset off.

(view code)

Io function newSectionReader

function newSectionReader(_r:stdgo.io.ReaderAt, _off:haxe.Int64, _n:haxe.Int64):stdgo.io.SectionReader
NewSectionReader returns a SectionReader that reads from r
        starting at offset off and stops with EOF after n bytes.

(view code)

Io function nopCloser

function nopCloser(_r:stdgo.io.Reader):stdgo.io.ReadCloser
NopCloser returns a ReadCloser with a no-op Close method wrapping
        the provided Reader r.
        If r implements WriterTo, the returned ReadCloser will implement WriterTo
        by forwarding calls to r.

(view code)

Io function pipe

function pipe():stdgo.Tuple<stdgo.io.PipeReader, stdgo.io.PipeWriter>
Pipe creates a synchronous in-memory pipe.
        It can be used to connect code expecting an io.Reader
        with code expecting an io.Writer.

Reads and Writes on the pipe are matched one to one except when multiple Reads are needed to consume a single Write. That is, each Write to the PipeWriter blocks until it has satisfied one or more Reads from the PipeReader that fully consume the written data. The data is copied directly from the Write to the corresponding Read (or Reads); there is no internal buffering.

It is safe to call Read and Write in parallel with each other or with Close. Parallel calls to Read and parallel calls to Write are also safe: the individual calls will be gated sequentially.

(view code)

Io function readAll

function readAll(_r:stdgo.io.Reader):stdgo.Tuple<Array<UInt>, stdgo.Error>
ReadAll reads from r until an error or EOF and returns the data it read.
        A successful call returns err == nil, not err == EOF. Because ReadAll is
        defined to read from src until EOF, it does not treat an EOF from Read
        as an error to be reported.

(view code)

Io function readAtLeast

function readAtLeast(_r:stdgo.io.Reader, _buf:Array<UInt>, _min:Int):stdgo.Tuple<Int, stdgo.Error>
ReadAtLeast reads from r into buf until it has read at least min bytes.
        It returns the number of bytes copied and an error if fewer bytes were read.
        The error is EOF only if no bytes were read.
        If an EOF happens after reading fewer than min bytes,
        ReadAtLeast returns ErrUnexpectedEOF.
        If min is greater than the length of buf, ReadAtLeast returns ErrShortBuffer.
        On return, n >= min if and only if err == nil.
        If r returns an error having read at least min bytes, the error is dropped.

(view code)

Io function readFull

function readFull(_r:stdgo.io.Reader, _buf:Array<UInt>):stdgo.Tuple<Int, stdgo.Error>
ReadFull reads exactly len(buf) bytes from r into buf.
        It returns the number of bytes copied and an error if fewer bytes were read.
        The error is EOF only if no bytes were read.
        If an EOF happens after reading some but not all the bytes,
        ReadFull returns ErrUnexpectedEOF.
        On return, n == len(buf) if and only if err == nil.
        If r returns an error having read at least len(buf) bytes, the error is dropped.

(view code)

Io function teeReader

function teeReader(_r:stdgo.io.Reader, _w:stdgo.io.Writer):stdgo.io.Reader
TeeReader returns a Reader that writes to w what it reads from r.
        All reads from r performed through it are matched with
        corresponding writes to w. There is no internal buffering -
        the write must complete before the read completes.
        Any error encountered while writing is reported as a read error.

(view code)

Io function writeString

function writeString(_w:stdgo.io.Writer, _s:String):stdgo.Tuple<Int, stdgo.Error>
WriteString writes the contents of the string s to w, which accepts a slice of bytes.
        If w implements StringWriter, its WriteString method is invoked directly.
        Otherwise, w.Write is called exactly once.

(view code)

Typedefs

import stdgo.io.*

typedef ByteReader

typedef ByteReader = stdgo._internal.io.ByteReader;

typedef ByteScanner

typedef ByteScanner = stdgo._internal.io.ByteScanner;

typedef ByteWriter

typedef ByteWriter = stdgo._internal.io.ByteWriter;

typedef Closer

typedef Closer = stdgo._internal.io.Closer;

typedef ReadCloser

typedef ReadCloser = stdgo._internal.io.ReadCloser;

typedef ReadSeekCloser

typedef ReadSeekCloser = stdgo._internal.io.ReadSeekCloser;

typedef ReadSeeker

typedef ReadSeeker = stdgo._internal.io.ReadSeeker;

typedef ReadWriteCloser

typedef ReadWriteCloser = stdgo._internal.io.ReadWriteCloser;

typedef ReadWriteSeeker

typedef ReadWriteSeeker = stdgo._internal.io.ReadWriteSeeker;

typedef ReadWriter

typedef ReadWriter = stdgo._internal.io.ReadWriter;

typedef Reader

typedef Reader = stdgo._internal.io.Reader;

typedef ReaderAt

typedef ReaderAt = stdgo._internal.io.ReaderAt;

typedef ReaderFrom

typedef ReaderFrom = stdgo._internal.io.ReaderFrom;

typedef RuneReader

typedef RuneReader = stdgo._internal.io.RuneReader;

typedef RuneScanner

typedef RuneScanner = stdgo._internal.io.RuneScanner;

typedef Seeker

typedef Seeker = stdgo._internal.io.Seeker;

typedef StringWriter

typedef StringWriter = stdgo._internal.io.StringWriter;

typedef T__struct_0

typedef T__struct_0 = stdgo._internal.io.T__struct_0;

typedef WriteCloser

typedef WriteCloser = stdgo._internal.io.WriteCloser;

typedef WriteSeeker

typedef WriteSeeker = stdgo._internal.io.WriteSeeker;

typedef Writer

typedef Writer = stdgo._internal.io.Writer;

typedef WriterAt

typedef WriterAt = stdgo._internal.io.WriterAt;

typedef WriterTo

typedef WriterTo = stdgo._internal.io.WriterTo;

Abstracts

abstract LimitedReader

(view file containing code)

abstract SectionReader

(view file containing code)

abstract OffsetWriter

(view file containing code)

abstract T_teeReader

(view file containing code)

abstract T_discard

(view file containing code)

abstract T_nopCloser

(view file containing code)

abstract T_nopCloserWriterTo

(view file containing code)

abstract T_eofReader

(view file containing code)

abstract T_multiReader

(view file containing code)

abstract T_multiWriter

(view file containing code)

abstract T_onceError

(view file containing code)

abstract T_pipe

(view file containing code)

abstract PipeReader

(view file containing code)

abstract PipeWriter

(view file containing code)