 GENERIC: stream-read-until ( seps stream -- seq sep/f )
 GENERIC: stream-read-partial-unsafe ( n buf stream -- count )
 GENERIC: stream-readln ( stream -- str/f )
+GENERIC: stream-contents ( stream -- seq )
 
 GENERIC: stream-write1 ( elt stream -- )
 GENERIC: stream-write ( data stream -- )


GENERIC: stream-tell ( stream -- n )
GENERIC: stream-seek ( n seek-type stream -- )

: stream-print ( str stream -- ) [ stream-write ] [ stream-nl ] bi ;


M: object stream-read-until read-until-loop ;
M: object stream-readln
    "\n" swap stream-read-until drop ; inline
M: object stream-contents (stream-contents-by-length-or-block) ; inline
M: object stream-seekable? drop f ; inline
M: object stream-length drop f ; inline

M: object stream-write [ stream-write1 ] curry each ; inline
M: object stream-flush drop ; inline
M: object stream-nl CHAR: \n swap stream-write1 ; inline

