     input-stream get stream-lines ; inline
 
 : each-stream-block ( ... stream quot: ( ... block -- ... ) -- ... )
-    swap 65536 swap [ stream-read-partial ] 2curry each-morsel ; inline
+    swap [ 65536 swap stream-read-partial ] curry each-morsel ; inline
+
+: each-stream-block* ( ... buffer stream quot: ( ... n ptr -- ... ) -- ... )
+    -rot [ [ byte-length ] [ >c-ptr ] bi ] dip
+    [ [ stream-read-partial-unsafe ] curry keep ] 3curry each-morsel ; inline
 
 : each-block ( ... quot: ( ... block -- ... ) -- ... )
     input-stream get swap each-stream-block ; inline
+
+: each-block* ( ... quot: ( ... block -- ... ) -- ... )
+    input-stream get swap each-stream-block* ; inline
 
 : stream-contents ( stream -- seq )
     [

        [ stream-element-exemplar concat-as ] bi
    ] with-disposal ;

: contents ( -- seq )
    input-stream get stream-contents ; inline

: stream-copy ( in out -- )
    [ [ [ write ] each-block ] with-output-stream ]

! Copyright (C) 2003, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien byte-arrays combinators continuations destructors
kernel math namespaces sequences sequences.private ;
IN: io

