1 USING: accessors io io.encodings io.encodings.ascii
2 io.encodings.string io.encodings.utf8 io.files
3 io.streams.byte-array io.streams.string kernel namespaces
8 [ "vocab:io/test/empty-file.txt" ascii file-lines ]
11 : lines-test ( file encoding -- line1 line2 )
12 [ readln readln ] with-file-reader ;
16 "This is another line."
18 "vocab:io/test/windows-eol.txt"
24 "This is another line."
26 "vocab:io/test/mac-os-eol.txt"
32 "This is another line."
34 "vocab:io/test/unix-eol.txt"
41 "Hello world\r\n1234" <string-reader>
42 dup stream-readln drop
49 "Hello world\r\n1234" <string-reader>
50 dup stream-readln drop
51 4 swap stream-read-partial
57 "Hello world\r\n1234" <string-reader>
58 dup stream-readln drop
64 input-stream get code>>
66 input-stream get code>>
72 output-stream get code>>
74 output-stream get code>>
75 ] with-byte-writer drop
84 "! lol\r\n! wat\r\n" utf8 encode
96 "! lol\r\n! wat\r\n" utf8 encode