Read2
Implements ISO's read/2: parses the next term from the input stream identified by the first argument (an alias or $stream(...) term) and unifies it with the second. See IOPrimitiveUtils.readTermAndReply for the shared implementation (including the same end-of-stream-fails deviation from ISO documented on Read1).
Throws
if the first argument is unbound.
if it does not identify an open channel.
(stream_type) if it identifies an output channel instead.
if the stream's next term is malformed Prolog syntax.