Package COM.INFORMATIMAGO.COMMON-LISP.CESARUM.STREAM

This package exports utility functions about streams.


See also: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.FILE


License:

    AGPL3
    
    Copyright Pascal J. Bourguignon 2003 - 2012
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
    
    You should have received a copy of the GNU Affero General Public License
    along with this program.
    If not, see <http://www.gnu.org/licenses/>

(bare-stream stream &key direction)
function
RETURN: A stream or a list of streams that are not compound streams
        (and therefore usable by #+clisp SOCKET:SOCKET-STATUS).
(bvstream-position bvstream position)
generic-function
Set the position of the BVSTREAM.
(bvstream-read-byte bvstream)
generic-function
Read a byte from the BVSTREAM.
(bvstream-write-byte bvstream byte)
generic-function
Write a byte to the BVSTREAM.
(contents-from-stream stream &key length min-size max-extend)
function
STREAM:     May be a binary or character, file or non-file stream.
LENGTH:     NIL, or the number of stream elements to read.
MIN-SIZE:   Minimum pre-allocated buffer size. If LENGTH is given, or STREAM
            has a FILE-LENGTH, then the MIN-SIZE is ignored.
MAX-EXTEND: NIL ==> double the buffer size, or double the buffer size until
            it's greater than MAX-EXTEND, and then increment by MAX-EXTEND.
RETURN:     A vector containing the elements read from the STREAM.
(copy-over stream from-pos to-pos &key element-type)
function
DO:         Copies elements from the FROM-POS to the end of the STREAM
            to the TO-POS.
POST:       (file-position stream) == (+ to-pos (- eof-pos from-ops))
NOTE:       The file is not truncated.
(copy-stream from to)
function
Copy into TO from FROM until end of the input file.  Do not
translate or otherwise maul anything.
AUTHORS: Daniel Barlow, Xarch
(stream-input-stream stream)
generic-function
RETURN: A simple INPUT-STREAM.
(stream-output-stream stream)
generic-function
RETURN: A simple OUTPUT-STREAM.
(stream-to-string-list stream)
function
RETURN:  the list of lines collected from stream.
(with-input-from-byte-vector (var byte-vector &key index start end) &body body)
macro
DO:     Execute the BODY with VAR bound to an input byte vector stream
        reading bytes from the BYTE-VECTOR, from START to END.  If
        INDEX is given it should be a place into which the last
        position is stored.
RETURN: The last position.
(with-output-to-byte-vector (var &optional byte-vector-form &key element-type) &body body)
macro

DO:             Execute the BODY with VAR bound to an output byte vector
                stream.  If BYTE-VECTOR-FORM is given it should produce a byte
                vector with a fill-pointer where the bytes written to the
                bvstream are stored.
ELEMENT-TYPE:   The type of bytes. If BYTE-VECTOR-FORM is nil, one can
                choose a different element-type for the byte vector.
RETURN:         The byte vector written.