]> gitweb.factorcode.org Git - factor.git/blob - basis/io/streams/null/null.factor
Remove stream-peek and stream-peek1, re-implement dns vocab to not need this abstraction
[factor.git] / basis / io / streams / null / null.factor
1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel io destructors io.streams.plain ;
4 IN: io.streams.null
5
6 SINGLETONS: null-reader null-writer ;
7 UNION: null-stream null-reader null-writer ;
8 INSTANCE: null-writer plain-writer
9
10 M: null-stream dispose drop ;
11
12 M: null-reader stream-element-type drop +byte+ ;
13 M: null-reader stream-readln drop f ;
14 M: null-reader stream-read1 drop f ;
15 M: null-reader stream-read-until 2drop f f ;
16 M: null-reader stream-read 2drop f ;
17
18 M: null-writer stream-element-type drop +byte+ ;
19 M: null-writer stream-write1 2drop ;
20 M: null-writer stream-write 2drop ;
21 M: null-writer stream-flush drop ;
22
23 : with-null-reader ( quot -- )
24     null-reader swap with-input-stream* ; inline
25
26 : with-null-writer ( quot -- )
27     null-writer swap with-output-stream* ; inline