UPDATE-MONITOR now returns NIL if the file hasn't been changed,
[iolib.git] / io.event / io-buffer.lisp
blobd1b5f31ea9cb20f7b755668a95f5772e0086a749
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Indent-tabs-mode: NIL -*-
2 ;;;
3 ;;; io-buffer.lisp - Manage a connection buffer.
4 ;;;
5 ;;; Copyright (C) 2007, Stelian Ionescu <sionescu@common-lisp.net>
6 ;;;
7 ;;; This code is free software; you can redistribute it and/or
8 ;;; modify it under the terms of the version 2.1 of
9 ;;; the GNU Lesser General Public License as published by
10 ;;; the Free Software Foundation, as clarified by the
11 ;;; preamble found here:
12 ;;; http://opensource.franz.com/preamble.html
13 ;;;
14 ;;; This program is distributed in the hope that it will be useful,
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU Lesser General
20 ;;; Public License along with this library; if not, write to the
21 ;;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22 ;;; Boston, MA 02110-1301, USA
24 (in-package :io.event)
26 (defclass io-buffer ()
27 ((data :accessor data-of)
28 (size :accessor size-of)
29 (start :initarg :start :accessor start-of)
30 (end :initarg :end :accessor end-of))
31 (:default-initargs :start 0 :end 0))
33 (defvar *default-buffer-size* 4096)
35 (defmethod initialize-instance :after ((buffer io-buffer) &key
36 (size *default-buffer-size*))
37 (setf (data-of buffer) (make-array (or size *default-buffer-size*)
38 :element-type '(unsigned-byte 8)
39 :initial-element 0)
40 (size-of buffer) size))