Reads up to p.byteLength bytes into
p. It resolves to the number
of bytes read (
p.byteLength) and any error encountered.
p.byteLength, it may use all of
scratch space during the call. If some data is available but not
read() conventionally returns what is available
instead of waiting for more.
read() encounters an error or end-of-file condition after
0 bytes, it returns the number of bytes read.
It may return the (non-nil) error from the same call or return the error
0) from a subsequent call. An instance of this general case
is that a
Reader returning a non-zero number of bytes at the end of the
input stream may return either
null. The next
read() should return
Callers should always process the
0 bytes returned before
EOF. Doing so correctly handles I/O errors that happen
after reading some bytes and also both of the allowed
read() are discouraged from returning a zero byte
count with a
null error, except when
should treat a return of
null as indicating that nothing
happened; in particular it does not indicate
Implementations must not retain
Seek sets the offset for the next
write() to offset,
interpreted according to
SeekStart means relative to the start
of the file,
SeekCurrent means relative to the current offset, and
SeekEnd means relative to the end. Seek returns the new offset relative
to the start of the file and an error, if any.
Seeking to an offset before the start of the file is an error. Seeking to any positive offset is legal, but the behavior of subsequent I/O operations on the underlying object is implementation-dependent.
Generated using TypeDoc