eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SelectingReadStream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: SelectingReadStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--SelectingReadStream

Package:
stx:libbasic2
Category:
Streams-Misc
Version:
rev: 1.5 date: 2014/04/30 18:20:55
user: cg
file: SelectingReadStream.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


A stream which only delivers elements for which a select block returns true
from an underlying stream. 

Needs readAhead for proper atEnd handling.


[instance variables:]
    hasReadAhead        - because nil is a valid read-element,
                        this is used to know if readAhead is valid.

copyright

COPYRIGHT (c) 2009 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  on: aStream selecting: aBlock


Instance protocol:

instance creation
o  on: aStream selecting: aBlock

queries
o  atEnd
(comment from inherited method)
return true if the end of the stream has been reached;
- we do not know here how to do it, it must be redefined in subclass

o  contentsSpecies
return a class of which instances will be returned, when
parts of the collection are asked for.
(see upTo-kind of methods in Stream)

reading
o  next
(comment from inherited method)
return the next element of the stream
- we do not know here how to do it, it must be redefined in subclass


Examples:


|s|

s := SelectingReadStream 
        on:#(1 2 3 4 5 6 7 8) readStream
        selecting:[:each | each even].
s upToEnd  


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 30 Dec 2024 15:57:31 GMT