MultiReadStream.st
author Claus Gittinger <cg@exept.de>
Sat, 02 May 2020 21:40:13 +0200
changeset 5476 7355a4b11cb6
parent 5383 a0ad4c5497f3
permissions -rw-r--r--
#FEATURE by cg class: Socket class added: #newTCPclientToHost:port:domain:domainOrder:withTimeout: changed: #newTCPclientToHost:port:domain:withTimeout:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5383
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     1
"{ Encoding: utf8 }"
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     2
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     3
"
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     4
 COPYRIGHT (c) 2018 by eXept Software AG
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     5
              All Rights Reserved
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     6
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     7
 This software is furnished under a license and may be used
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     8
 only in accordance with the terms of that license and with the
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    11
 other person.  No title to or ownership of the software is
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    12
 hereby transferred.
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    13
"
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libbasic2' }"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
4090
07de7c4cf517 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
    16
"{ NameSpace: Smalltalk }"
07de7c4cf517 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
    17
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
PeekableStream subclass:#MultiReadStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:'streamStack'
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Streams-Misc'
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!MultiReadStream class methodsFor:'documentation'!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
5383
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    27
copyright
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    28
"
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    29
 COPYRIGHT (c) 2018 by eXept Software AG
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    30
              All Rights Reserved
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    31
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    32
 This software is furnished under a license and may be used
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    33
 only in accordance with the terms of that license and with the
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    35
 be provided or otherwise made available to, or used by, any
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    36
 other person.  No title to or ownership of the software is
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    37
 hereby transferred.
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    38
"
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    39
!
a0ad4c5497f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5245
diff changeset
    40
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
4457
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    43
    Stacked streams. 
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    44
    
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    45
    At any time, another stream can be stacked onto a stream stack. 
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    46
    Making this stream's contents to be returned before the rest. 
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    47
    To the stream reader, this looks like a single stream delivering the
3287
c684c48697d0 class: MultiReadStream
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
    48
    embedded stream contents sequentially.
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
4457
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    50
    Useful when reading files which include each other, 
9c524350fcf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    51
    or to handle define-macro expansion in a c-parser.
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
3272
7e58d594ab27 documentation
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
    53
    [Author:]
7e58d594ab27 documentation
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
    54
        Claus Gittinger
7e58d594ab27 documentation
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
    55
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    [instance variables:]
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Created: / 21-05-2010 / 14:34:48 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
examples
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    |s|
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    s := MultiReadStream on:('abcd' readStream).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    self assert:(s peek == $a).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    self assert:(s next == $a).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    s pushInputStream:('1234' readStream).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    self assert:(s next == $1).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    self assert:(s next == $2).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    s pushInputStream:('aa' readStream).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    self assert:(s next == $a).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    self assert:(s next == $a).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    self assert:(s atEnd not).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    self assert:(s next == $3).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    self assert:(s next == $4).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    self assert:(s next == $b).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    self assert:(s next == $c).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    self assert:(s next == $d).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    self assert:(s atEnd).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    self assert:(s peek == nil).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    self assert:(s next == nil).
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "Created: / 21-05-2010 / 14:27:53 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
! !
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
!MultiReadStream class methodsFor:'instance creation'!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
on:aReadStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    ^ self basicNew pushInputStream:aReadStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    "Created: / 21-05-2010 / 14:26:03 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
! !
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
5244
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
    97
!MultiReadStream methodsFor:'accessing'!
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
    98
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
    99
readStream
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   100
    ^ self
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   101
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   102
    "Created: / 21-05-2010 / 14:51:05 / cg"
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   103
! !
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   104
5245
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   105
!MultiReadStream methodsFor:'obsolete positioning'!
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   106
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   107
position0Based
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   108
    <resource: #obsolete>
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   109
    ^ self position
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   110
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   111
    "Created: / 21-05-2010 / 14:52:40 / cg"
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   112
!
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   113
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   114
position1Based
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   115
    <resource: #obsolete>
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   116
    ^ self position + 1
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   117
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   118
    "Created: / 21-05-2010 / 14:52:40 / cg"
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   119
! !
b7c6a5b7bf44 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5244
diff changeset
   120
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!MultiReadStream methodsFor:'private'!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
checkCurrentStreamAtEnd
2655
2cb26ee25173 changed:8 methods
Stefan Vogel <sv@exept.de>
parents: 2654
diff changeset
   124
    [streamStack size > 1 and:[streamStack last atEnd]] whileTrue:[
2cb26ee25173 changed:8 methods
Stefan Vogel <sv@exept.de>
parents: 2654
diff changeset
   125
        "keep the last stream, so that the #position kludge will work"
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        self popInputStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    ].
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    "Created: / 21-05-2010 / 14:30:20 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
! !
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
5244
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   132
!MultiReadStream methodsFor:'queries'!
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
atEnd
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    self checkCurrentStreamAtEnd.
2655
2cb26ee25173 changed:8 methods
Stefan Vogel <sv@exept.de>
parents: 2654
diff changeset
   136
    ^ streamStack isEmptyOrNil or:[streamStack last atEnd]
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "Created: / 21-05-2010 / 14:31:48 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
2450
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   141
contentsSpecies 
3090
76525cef6c24 class: MultiReadStream
Claus Gittinger <cg@exept.de>
parents: 3081
diff changeset
   142
    "return a class of which instances will be returned, when
76525cef6c24 class: MultiReadStream
Claus Gittinger <cg@exept.de>
parents: 3081
diff changeset
   143
     parts of the collection are asked for. 
76525cef6c24 class: MultiReadStream
Claus Gittinger <cg@exept.de>
parents: 3081
diff changeset
   144
     (see upTo-kind of methods in Stream)"
76525cef6c24 class: MultiReadStream
Claus Gittinger <cg@exept.de>
parents: 3081
diff changeset
   145
2450
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   146
    streamStack isEmptyOrNil ifTrue:[^ super contentsSpecies].
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   147
    ^ streamStack first contentsSpecies
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   148
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   149
    "Created: / 21-05-2010 / 14:44:26 / cg"
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   150
!
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   151
2463
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   152
position
4090
07de7c4cf517 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   153
    "/ that's debatable !!
2463
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   154
    "/ the code below only makes sense, if we see the multiStream as some kind of
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   155
    "/ macro-expanding c-define stream
2654
b6e04b9a3500 added: #position0Based
Stefan Vogel <sv@exept.de>
parents: 2463
diff changeset
   156
b6e04b9a3500 added: #position0Based
Stefan Vogel <sv@exept.de>
parents: 2463
diff changeset
   157
    streamStack isEmptyOrNil ifTrue:[
2655
2cb26ee25173 changed:8 methods
Stefan Vogel <sv@exept.de>
parents: 2654
diff changeset
   158
        "we assume we are at the beginning"
2cb26ee25173 changed:8 methods
Stefan Vogel <sv@exept.de>
parents: 2654
diff changeset
   159
        ^ 0
2654
b6e04b9a3500 added: #position0Based
Stefan Vogel <sv@exept.de>
parents: 2463
diff changeset
   160
    ].
2463
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   161
    ^ streamStack first position
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   162
cbb5fd7ae437 added: #position
Stefan Vogel <sv@exept.de>
parents: 2450
diff changeset
   163
    "Created: / 21-05-2010 / 14:52:40 / cg"
5244
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   164
! !
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   165
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   166
!MultiReadStream methodsFor:'reading'!
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   167
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   168
next
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   169
    self checkCurrentStreamAtEnd.
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   170
    streamStack isEmptyOrNil ifTrue:[^ self pastEndRead].
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   171
    ^ streamStack last next
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   172
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   173
    "Created: / 21-05-2010 / 14:31:23 / cg"
2450
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   174
!
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   175
5244
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   176
peek
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   177
    self checkCurrentStreamAtEnd.
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   178
    streamStack isEmptyOrNil ifTrue:[^ self pastEndRead].
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   179
    ^ streamStack last peek
2450
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   180
5244
d03ba5173efe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4457
diff changeset
   181
    "Created: / 21-05-2010 / 14:29:06 / cg"
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
! !
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
!MultiReadStream methodsFor:'stream stacking'!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
popInputStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    streamStack removeLast
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "Created: / 21-05-2010 / 14:25:30 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
pushInputStream:aReadStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    streamStack isNil ifTrue:[
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
        streamStack := OrderedCollection new.
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    ].
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    streamStack add:aReadStream
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    "Created: / 21-05-2010 / 14:25:17 / cg"
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
! !
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
!MultiReadStream class methodsFor:'documentation'!
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
version_CVS
4090
07de7c4cf517 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   204
    ^ '$Header$'
2449
1401dd52e200 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
! !
3081
a95c8fd7b433 class: MultiReadStream
Stefan Vogel <sv@exept.de>
parents: 2655
diff changeset
   206