deferred void close;
id flushInput;
deferred byte read;
stream-eos
condition upon end-of-stream.
deferred int read;
int readBytes int num into MutableByteArray buffer;
num
bytes from the stream into the buffer
, starting
to add bytes at its current length. Return the number of bytes
successfully read, which is 0 for end-of-stream.
deferred int readRange (int, int) (start, num) into MutableByteArray buffer;
num
bytes from the stream into the buffer
, by
writing in it from position start
. Return the number of bytes
successfully read, which is 0 for end-of-stream.
MutableByteString readLine;
nil
upon end of file (if no characters
have been collected).
MutableByteArray readLineInto MutableByteArray buf truncate: boolean trunc = YES;
buf
. Return nil
upon end of file (if no
characters have been collected). If the optional truncate
is not
NO, the buffer is truncated before use.
local static MutableByteString print_buffer;
print base:...
.
id flushOutput;
id nl;
private MutableByteString print_buffer;
print_buffer
, creating it iff necessary.
id print boolean b;
id print byte b;
id print char c;
id print int i;
id print long l;
id print float f;
id print double d;
id print pointer addr;
id print All object;
id print dynamic x;
print
to self
for each element of the tuple x
.
id print int value base: int base = 10 space: int space = 0 flush: int flush = -1 signed: int how_signed = -1 range: char digit_10 = char ('a');
value
to the receiving stream.
The optional base
dictates the base of the representation, which
defaults to 10.
If the optional space
is not 0, it is the number of positions the
representation must at least occupy.
If space
is not 0, the optional flush
dictates how the
representation is to be flushed. A negative value means left, 0 for
center, and a positive value dictates a right shift. The absolute
value of flush
indicates the amount of whitespace which must be
available at the other end.
The optional signed
should be 0 for unsigned, or 1 for signed. If
it is -1 (the default) the value is assumed unsigned, unless base
has its default value, 10.
The optional digit_10
sets the value to use for the decimal value 10
when using a base
exceeding that value.
deferred void write byte b;
b
, signaling a condition upon eof.
deferred int write byte b;
b
and return the number of bytes actually written.
deferred int writeBytes int num from pointer address;
num
bytes
from address
to the stream, and return the number of bytes written.
int writeRange (int, int) (start, length) from ByteArray buffer;
int writeBytes ByteArray buffer;
deferred long position;
deferred void seek long offset relative: int whence = STREAM_SEEK_SET;
whence
defaults to
STREAM_SEEK_SET
, for absolute positioning. Possible other values
are STREAM_SEEK_CUR
, for positioning relative to the current
position, and STREAM_SEEK_END
, to work relative to the end.
instance (id) with Stream s;
public InputOutputStream stream;
void close;
id init Stream s;
static public InputStream in;
stdin
in C.
static public OutputStream out;
stdout
.
static public InputOutputStream err;
stderr
. Like out
,
this stream is buffered.
void close int descriptor;
descriptor
. Raises a stream-error
on failure.