File tom/streams


class tom.Stream

Inherits

State supers
Conditions
Behaviour supers
All

instance tom.Stream

Inherits

State supers
Conditions
Behaviour supers
All

methods

deferred void
  close;
Undocumented.


class tom.InputStream

Inherits

State supers
Stream

instance tom.InputStream

methods

id
  flushInput;
Discard any unread input. The default implementation does nothing.

deferred byte
  read;
Read a byte from the receiving stream. This raises a stream-eos condition upon end-of-stream.

deferred int
  read;
Read a byte from the receiving stream. Return -1 for end-of-stream.

int
  readBytes int num
       into MutableByteArray buffer;
Read at most 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;
Read at most 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;
Read a `\n' terminated sequence of bytes and return them (without the `\n' at the end). Return nil upon end of file (if no characters have been collected).

MutableByteArray
  readLineInto MutableByteArray buf
     truncate: boolean trunc = YES;
Read a `\n' terminated sequence of bytes and return them (without the `\n' at the end) in 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.


class tom.OutputStream

Inherits

State supers
Stream

variables

local static MutableByteString print_buffer;
The buffer used by print base:....

instance tom.OutputStream

methods

id
  flushOutput;
Write out any unwritten (buffered) output. The default implementation does nothing.

id
  nl;
Output a new line to the receiving stream. An interactive stream should override this to also flush its output if it desires line based buffering.

private MutableByteString
  print_buffer;
Return the truncated print_buffer, creating it iff necessary.

id
  print boolean b;
Undocumented.

id
  print byte b;
Undocumented.

id
  print char c;
Undocumented.

id
  print int i;
Undocumented.

id
  print long l;
Undocumented.

id
  print float f;
Undocumented.

id
  print double d;
Undocumented.

id
  print pointer addr;
Undocumented.

id
  print All object;
Undocumented.

id
  print dynamic x;
Send 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');
Output the 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;
Write the byte b, signaling a condition upon eof.

deferred int
  write byte b;
Write the byte b and return the number of bytes actually written.

deferred int
  writeBytes int num
        from pointer address;
The lowest level multiple-byte writing method: Write the num bytes from address to the stream, and return the number of bytes written.

int
  writeRange (int, int) (start, length)
        from ByteArray buffer;
Undocumented.

int
  writeBytes ByteArray buffer;
Undocumented.


class tom.InputOutputStream

Inherits

State supers
InputStream, OutputStream

instance tom.InputOutputStream


class tom.SeekableStream

Inherits

State supers
Stream, Constants

instance tom.SeekableStream

methods

deferred long
  position;
Return the current position.

deferred void
       seek long offset
  relative: int whence = STREAM_SEEK_SET;
Set the position. Any following operation will operate from the new position. The optional argument 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.


class tom.StreamStream

Inherits

State supers
Stream, State

methods

instance (id)
  with Stream s;
Undocumented.

instance tom.StreamStream

variables

public InputOutputStream stream;
The stream to which we output and/or from which we input.

methods

void
  close;
Undocumented.

id
  init Stream s;
Undocumented.


class tom.stdio

Inherits

Behaviour supers
All

variables

static public InputStream in;
The stream connected to descriptor 0, known as stdin in C.
static public OutputStream out;
The stream connected to descriptor 1, C's stdout.
static public InputOutputStream err;
The stream connected to descriptor 2, C's stderr. Like out, this stream is buffered.

methods

void
  close int descriptor;
Close the descriptor. Raises a stream-error on failure.

instance tom.stdio

Inherits

Behaviour supers
All

Generated by tm 1.01.