From ef8a179f344d4dbb92e02736e79009d5560f09d5 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 10 Oct 2011 23:02:27 -0700 Subject: [PATCH] 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. --- core/io/io.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/io/io.factor b/core/io/io.factor index a4b93f3f82..8e34839e12 100644 --- a/core/io/io.factor +++ b/core/io/io.factor @@ -9,8 +9,10 @@ SYMBOLS: +byte+ +character+ ; GENERIC: stream-element-type ( stream -- type ) GENERIC: stream-read1 ( stream -- elt ) +GENERIC: stream-read-unsafe ( n buf stream -- n' ) GENERIC: stream-read ( n stream -- seq ) 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-readln ( stream -- str/f )