method READ

Documentation for method READ assembled from the following types:

class IO::Handle

From IO::Handle

(IO::Handle) method READ

Defined as:

method READ(IO::Handle:D: Int:D \bytes --> Buf:D)

Called whenever a read operation is performed on the handle. Receives the number of bytes requested to read. Returns a Buf with those bytes which can be used to either fill the decoder buffer or returned from reading methods directly. The result is allowed to have fewer than the requested number of bytes, including no bytes at all.

If you provide your own .READ, you very likely need to provide your own .EOF as well, for all the features to behave correctly.

The compiler may call .EOF method any number of times during a read operation to ascertain whether a call to .READ should be made. More bytes than necessary to satisfy a read operation may be requested from .READ, in which case the extra data may be buffered by the IO::Handle or the decoder it's using, to fullfill any subsequent reading operations, without necessarilly having to make another .READ call.

class IO::CatHandle

From IO::CatHandle

(IO::CatHandle) method READ

Defined as:

multi method EOF(|)

The IO::CatHandle type overrides this method to throw X::NYI exception. If you have a good idea for how this method should behave, tell Rakudo developers about it!