TTransport

An entity data can be read from and/or written to.

A TTransport implementation may capable of either reading or writing, but not necessarily both.

Members

Functions

borrow
const(ubyte)[] borrow(ubyte* buf, size_t len)

Attempts to return a slice of <code>len</code> bytes of incoming data, possibly copied into buf, not consuming them (i.e.: a later read will return the same data).

close
void close()

Closes the transport.

consume
void consume(size_t len)

Remove len bytes from the transport. This must always follow a borrow of at least len bytes, and should always succeed.

flush
void flush()

Flushes any pending data to be written.

isOpen
bool isOpen()

Whether this transport is open.

open
void open()

Opens the transport for communications.

peek
bool peek()

Tests whether there is more data to read or if the remote side is still open.

read
size_t read(ubyte[] buf)

Attempts to fill the given buffer by reading data.

readAll
void readAll(ubyte[] buf)

Fills the given buffer by reading data into it, failing if not enough data is available.

readEnd
size_t readEnd()

Must be called by clients when read is completed.

write
void write(ubyte[] buf)

Writes the passed slice of data.

writeEnd
size_t writeEnd()

Must be called by clients when write is completed.

Meta