Handbook
Glossary
peek-stream
Vocabulary
io
.
streams
.
peek
Definition
IN:
io.streams.peek
TUPLE:
peek-stream
stream peeked
;
Methods
USING:
accessors
destructors
io.streams.peek
;
M:
peek-stream
dispose
stream>>
dispose
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-element-type
stream>>
stream-element-type
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-flush
stream>>
stream-flush
;
USING:
accessors
alien
io
io.ports
io.streams.peek
kernel
math
sequences
;
M::
peek-stream
stream-read-unsafe
( n buf stream -- count )
stream
peeked>>
:>
peeked peeked
length
:>
#peeked #peeked 0
=
[
n buf stream
stream>>
stream-read-unsafe
]
[
#peeked n
>=
[
peeked
<reversed>
n
head-slice
0 buf
copy
peeked
[
length
n
-
]
keep
shorten
n
]
[
peeked
<reversed>
0 buf
copy
0 peeked
shorten
n #peeked
-
:>
n' stream
stream>>
input-port?
[
#peeked buf
<displaced-alien>
]
[
buf #peeked
tail-slice
]
if
:>
buf' n' buf' stream
stream-read-unsafe
#peeked
+
]
if
]
if
;
USING:
io
io.streams.peek
kernel
;
M:
peek-stream
stream-read-until
swap
64
pick
stream-new-resizable
peek-stream-read-until
[
nip
swap
stream-like
]
dip
;
USING:
accessors
io
io.streams.peek
kernel
sequences
;
M:
peek-stream
stream-read1
dup
peeked>>
[
stream>>
stream-read1
]
[
pop
nip
]
if-empty
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-seek
stream>>
stream-seek
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-tell
stream>>
stream-tell
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-write
stream>>
stream-write
;
USING:
accessors
io
io.streams.peek
;
M:
peek-stream
stream-write1
stream>>
stream-write1
;