X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=io.lisp;h=8f38e0e6ca5fac9c9c016528d90b4a41990a5b72;hp=aedca9942a166d716bf11f44c227d711176ee105;hb=d557c191f92e4e5a3cd4ca3fdd14a78444002c64;hpb=09816397bfa39bd4b3c85e9f5fc05d30b073bacb diff --git a/io.lisp b/io.lisp index aedca99..8f38e0e 100644 --- a/io.lisp +++ b/io.lisp @@ -39,13 +39,12 @@ (defun read-file-to-string (file) "Opens a reads a file. Returns the contents as a single string" - (with-output-to-string (out) - (with-open-file (in file :direction :input) - (read-stream-to-string in)))) + (with-open-file (in file :direction :input) + (read-stream-to-string in))) (defun read-file-to-usb8-array (file) "Opens a reads a file. Returns the contents as single unsigned-byte array" - (with-open-file (in file :direction :input) + (with-open-file (in file :direction :input :element-type '(unsigned-byte 8)) (let* ((file-len (file-length in)) (usb8 (make-array file-len :element-type '(unsigned-byte 8))) (pos (read-sequence usb8 in))) @@ -322,7 +321,7 @@ (write-char #\: stream) (write-string (aref +datetime-number-strings+ minute) stream))) -(defun copy-binary-stream (in out &key (chunk-size 4096)) +(defun copy-binary-stream (in out &key (chunk-size 16384)) (do* ((buf (make-array chunk-size :element-type '(unsigned-byte 8))) (pos (read-sequence buf in) (read-sequence buf in))) ((zerop pos))