io: non-copying binary stream read generics

Add generics stream-read-unsafe and stream-read-partial-unsafe, which take a buffer pointer and return a count of bytes read instead of returning a freshly allocated byte array.
db4
Joe Groff 2011-10-10 23:02:27 -07:00
parent fde782cff6
commit ef8a179f34
1 changed files with 2 additions and 0 deletions

View File

@ -9,8 +9,10 @@ SYMBOLS: +byte+ +character+ ;
GENERIC: stream-element-type ( stream -- type ) GENERIC: stream-element-type ( stream -- type )
GENERIC: stream-read1 ( stream -- elt ) GENERIC: stream-read1 ( stream -- elt )
GENERIC: stream-read-unsafe ( n buf stream -- n' )
GENERIC: stream-read ( n stream -- seq ) GENERIC: stream-read ( n stream -- seq )
GENERIC: stream-read-until ( seps stream -- seq sep/f ) GENERIC: stream-read-until ( seps stream -- seq sep/f )
GENERIC: stream-read-partial-unsafe ( n buf stream -- n' )
GENERIC: stream-read-partial ( n stream -- seq ) GENERIC: stream-read-partial ( n stream -- seq )
GENERIC: stream-readln ( stream -- str/f ) GENERIC: stream-readln ( stream -- str/f )