1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2006 Floréal Morandat <morandat@lirmm.fr>
4 # Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
6 # This file is free software, which comes along with NIT. This software is
7 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
10 # is kept unaltered, and a notification of the changes is added.
11 # You are allowed to redistribute it and sell it, alone or is a part of
16 # Filter readed elements
17 var stream
: nullable IStream = null
28 # Filter outputed elements
29 var stream
: nullable OStream = null
31 # Can the stream be used to write
32 redef fun is_writable
: Bool
35 return stream
.is_writable
41 var _streams
: Iterator[IStream]
45 if stream
== null then
47 else if stream
.eof
then
56 redef fun stream
: nullable IStream
59 if res
== null and _streams
.is_ok
then
68 redef fun read_char
: Int
71 return stream
.read_char
76 while stream
!= null do
82 init with_streams
(streams
: Array[IStream])
84 _streams
= streams
.iterator
86 init(streams
: IStream ...)
88 _streams
= streams
.iterator
94 var _streams
: Array[OStream]
96 redef fun is_writable
: Bool
98 if stream
.is_writable
then
103 if i
.is_writable
then
111 redef fun write
(s
: Text)
116 if stream
.is_writable
then
131 init with_streams
(streams
: Array[OStream])
136 init(streams
: OStream ...)