CollectingReadStream.st
author Claus Gittinger <cg@exept.de>
Sat, 02 May 2020 21:40:13 +0200
changeset 5476 7355a4b11cb6
parent 5247 abb5d984aafa
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:
4330
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     1
"
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     2
 COPYRIGHT (c) 2009 by Claus Gittinger
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     3
              All Rights Reserved
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     4
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     5
 This software is furnished under a license and may be used
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     6
 only in accordance with the terms of that license and with the
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
     9
 other person.  No title to or ownership of the software is
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    10
 hereby transferred.
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    11
"
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic2' }"
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
4330
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    14
"{ NameSpace: Smalltalk }"
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    15
2673
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
    16
PeekableStream subclass:#CollectingReadStream
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'collectBlock inStream'
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
2365
992361c42f71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2363
diff changeset
    20
	category:'Streams-Misc'
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!CollectingReadStream class methodsFor:'documentation'!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
4330
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    25
copyright
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    26
"
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    27
 COPYRIGHT (c) 2009 by Claus Gittinger
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    28
              All Rights Reserved
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    29
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    30
 This software is furnished under a license and may be used
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    31
 only in accordance with the terms of that license and with the
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    34
 other person.  No title to or ownership of the software is
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    35
 hereby transferred.
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    36
"
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    37
!
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
    38
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
3270
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    41
    A stream which evaluates collectBlock for every element
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    42
    read from an underlying stream, providing the result from
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    43
    the evaluation as read-elements.
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    44
    Useful to process a readStream, for tracing or diverting to another
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    45
    processing stage.
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    46
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    47
    [Author:]
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    48
        Claus Gittinger
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
"
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
examples
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
"
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
                                                            [exBegin]
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    |s|
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    s := CollectingReadStream 
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
            on:#(1 2 3 4 5 6 7 8) readStream
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
            collecting:[:each | each squared].
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    s upToEnd  
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
                                                            [exEnd]
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
                                                            [exBegin]
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    |s|
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    s := (#(1 2 3 4 5 6 7 8) readStream 
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
            selecting:[:n | n odd])
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
                collecting:[:n | n squared].
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    s upToEnd    
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
                                                            [exEnd]
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
"
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
! !
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!CollectingReadStream class methodsFor:'instance creation'!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
3270
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    76
diverting:aStream to:anotherStream
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    77
    ^ self on:aStream collecting:[:el | anotherStream nextPut:el. el].
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    78
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    79
    "
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    80
     |s|
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    81
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    82
     s := CollectingReadStream 
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    83
            diverting:#(1 2 3 4 5 6 7 8) readStream
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    84
            to:Transcript.
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    85
     s upToEnd  
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    86
    "
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    87
!
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    88
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
on:aStream collecting:aBlock
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ self basicNew on:aStream collecting:aBlock
3270
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    91
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    92
    "
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    93
     |s|
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    94
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    95
     s := CollectingReadStream 
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    96
            on:#(1 2 3 4 5 6 7 8) readStream
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    97
            collecting:[:each | each squared].
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    98
     s upToEnd  
35d2087d156a class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    99
    "
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
! !
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
5247
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   102
!CollectingReadStream methodsFor:'accessing'!
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   103
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   104
readStream
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   105
    ^ self
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   106
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   107
    "Created: / 26-10-2011 / 17:25:43 / cg"
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   108
! !
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   109
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
!CollectingReadStream methodsFor:'instance creation'!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
on:aStream collecting:aBlock
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    inStream := aStream.
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    collectBlock := aBlock.
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
5247
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   117
!CollectingReadStream methodsFor:'obsolete positioning'!
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   118
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   119
position0Based
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   120
    <resource: #obsolete>
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   121
    ^ inStream position
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   122
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   123
    "Created: / 26-10-2011 / 17:23:56 / cg"
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   124
!
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   125
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   126
position1Based
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   127
    <resource: #obsolete>
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   128
    ^ inStream position + 1
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   129
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   130
    "Created: / 26-10-2011 / 17:22:42 / cg"
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   131
! !
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   132
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
!CollectingReadStream methodsFor:'queries'!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
atEnd
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    ^ inStream atEnd
3092
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   137
!
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   138
4951
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   139
contents
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   140
    ^ nil.
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   141
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   142
    "Created: / 26-05-2019 / 00:52:54 / Claus Gittinger"
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   143
!
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   144
3092
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   145
contentsSpecies
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   146
    "return a class of which instances will be returned, when
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   147
     parts of the collection are asked for. 
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   148
     (see upTo-kind of methods in Stream)"
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   149
98fe1a07634d class: CollectingReadStream
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
   150
    ^ inStream contentsSpecies.
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
! !
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
5247
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   153
!CollectingReadStream methodsFor:'reading'!
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
next
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    inStream atEnd ifTrue:[
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
        ^ self pastEndRead
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    ].
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    ^ collectBlock value:(inStream next)
2673
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   160
!
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   161
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   162
nextOrNil
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   163
    |ch|
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   164
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   165
    ch := inStream nextOrNil.
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   166
    ch notNil ifTrue:[
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   167
        collectBlock value:ch
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   168
    ].
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   169
    ^ ch
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   170
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   171
    "Created: / 26-10-2011 / 17:29:01 / cg"
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   172
!
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   173
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   174
nextPeek
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   175
    self next.
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   176
    ^ self peek
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   177
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   178
    "Created: / 26-10-2011 / 17:25:16 / cg"
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   179
!
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   180
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   181
peek
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   182
    ^ inStream peek
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   183
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   184
    "Created: / 26-10-2011 / 17:24:59 / cg"
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   185
!
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   186
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   187
peekOrNil
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   188
    ^ inStream peekOrNil
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   189
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   190
    "Created: / 26-10-2011 / 17:25:32 / cg"
5247
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   191
! !
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   192
abb5d984aafa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4951
diff changeset
   193
!CollectingReadStream methodsFor:'stream protocol'!
2673
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   194
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   195
position
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   196
    ^ inStream position
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   197
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   198
    "Created: / 26-10-2011 / 17:25:08 / cg"
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   199
!
ea71dab56953 fixes to make JavaScript file reader happier
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
   200
4951
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   201
position:newPos
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   202
    inStream position:newPos
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   203
3485b5b540a0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   204
    "Created: / 26-05-2019 / 00:57:19 / Claus Gittinger"
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
! !
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
!CollectingReadStream class methodsFor:'documentation'!
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
version_CVS
4330
ce8ba4a78326 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3270
diff changeset
   210
    ^ '$Header$'
2363
cfc0e027297d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
! !
3083
1befd13e063c class: CollectingReadStream
Stefan Vogel <sv@exept.de>
parents: 2673
diff changeset
   212