1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
13 # Stream class used as a Decorator over a stream
21 redef fun close
do origin
.close
24 # Reader decorator over a read-capable stream
29 redef type STREAM: Reader
31 redef fun raw_read_byte
do
32 return origin
.read_byte
35 redef fun raw_read_bytes
(ns
, len
) do
36 return origin
.read_bytes_to_cstring
(ns
, len
)
40 # Writer decorator over a write-capable stream
45 redef type STREAM: Writer
47 redef fun write_byte
(b
) do
51 redef fun write_bytes_from_cstring
(ns
, len
) do
52 origin
.write_bytes_from_cstring
(ns
, len
)
56 # Reader/Writer decorator over a duplex-capable stream
62 redef type STREAM: Duplex