stream-throw-on-eof ( ..a stream quot: ( ..a stream' -- ..b ) -- ..b )
Throwing exceptions on stream exhaustion

Next:throw-on-eof ( ..a quot: ( ..a -- ..b ) -- ..b )


Vocabulary
io.streams.throwing

Inputs and outputs
streaman input stream
quota quotation


Word description
Wraps a stream in a <throws-on-eof-stream> tuple and calls the quotation with this stream as the input-stream variable. Causes a stream-exhausted exception to be thrown upon stream exhaustion. The stream is left open after this combinator returns.This example will throw a stream-exhausted exception:
USING: io.streams.throwing prettyprint ; "abc" <string-reader> [ 4 read ] stream-throw-on-eof


Definition