1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
41
|
3 |
All Rights Reserved
|
1
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
WriteStream subclass:#ReadWriteStream
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Streams'
|
|
18 |
!
|
|
19 |
|
|
20 |
ReadWriteStream comment:'
|
|
21 |
|
5
|
22 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
41
|
23 |
All Rights Reserved
|
1
|
24 |
|
41
|
25 |
$Header: /cvs/stx/stx/libbasic/ReadWriteStream.st,v 1.5 1994-01-09 21:23:34 claus Exp $
|
1
|
26 |
'!
|
|
27 |
|
|
28 |
!ReadWriteStream methodsFor: 'access-reading'!
|
|
29 |
|
|
30 |
peek
|
41
|
31 |
"return the element to be read next without advancing read position.
|
|
32 |
If there are no more elements, nil is returned."
|
|
33 |
|
|
34 |
(position > readLimit) ifTrue:[^ nil].
|
1
|
35 |
^ collection at:position
|
|
36 |
!
|
|
37 |
|
|
38 |
next
|
41
|
39 |
"return the next element; advance read position.
|
|
40 |
If there are no more elements, nil is returned."
|
|
41 |
|
|
42 |
|element|
|
|
43 |
|
|
44 |
(position > readLimit) ifTrue:[^ nil].
|
|
45 |
element := collection at:position.
|
1
|
46 |
position := position + 1.
|
41
|
47 |
^ element
|
1
|
48 |
! !
|