- Implemented SEQUENCE-STREAMs, which are input/output streams defined on
some
specialized array type. The functions to create them are
(ext:make-sequence-input-stream vector &key :start :end
:external-format)
(ext:make-sequence-output-stream vector &key :external-format)
* If the array is a string, it is a character stream
* If the array is specialized over integers and EXTERNAL-FORMAT is
NIL
the stream is a binary stream.
* Otherwise, it is a binary string but READ/WRITE-CHAR may be used
on it.
Reading and writing does not preserve the original word size of the array
but rather threads the array as a collection of bytes (octets), writing
sequentially over it. Thus, if you use encodings such as UCS2 and UCS4,
make
sure that you choose the right endianness to match the shape of the
array.
Some examples
> (let ((a (make-array 16 :element-type '(unsigned-byte 8) :initial-element
3 :fill-pointer 0)))
(with-open-stream (s (ext:make-sequence-output-stream a))
(write-byte 2 s) (write-byte 3 s))
a)
#(2 3)
> (let ((a (make-array 16 :element-type '(unsigned-byte 8) :initial-element
3 :fill-pointer 0)))
(with-open-stream (s (ext:make-sequence-output-stream a :external-format
:utf-8))
(write-char #\a s) (write-char #\b s) (write-char (code-char 1024) s))
a)
#(97 98 208 128)
> (let ((a (make-array 16 :element-type '(unsigned-byte 8) :initial-element
97)))
(with-open-stream (s (ext:make-sequence-input-stream a))
(read-byte s)))
97
> (let ((a (make-array 16 :element-type '(unsigned-byte 8) :initial-element
97)))
(with-open-stream (s (ext:make-sequence-input-stream a :external-format
:latin-1))
(read-char s)))
#\a
--
Instituto de FĂsica Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list