eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ReadWriteStream':

Home

everywhere
www.exept.de
for:
[back]

Class: ReadWriteStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--PeekableStream
         |
         +--PositionableStream
            |
            +--WriteStream
               |
               +--ReadWriteStream
                  |
                  +--ExternalStream

Package:
stx:libbasic
Category:
Streams
Version:
rev: 1.30 date: 2009/07/08 18:01:50
user: stefan
file: ReadWriteStream.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


ReadWriteStreams allow both read- and write-access to some collection.
To allow this, they reenable some methods blocked in WriteStream.
(being one of the seldom places, where multiple inheritance could be
 of good use in smalltalk).

Claus:
    I personally find the ReadStream - WriteStream - ReadWriteStream
    organization brain-damaged. It would be better to have an attribute
    (such as readOnly / writeOnly / readWrite) in an InternalStream subclass 
    of Stream ...


Instance protocol:

access-reading
o  next
return the next element; advance read position.
If there are no more elements, nil is returned.

o  nextByte
return the next element; advance read pointer.
return nil, if there is no next element

o  peek
return the element to be read next without advancing read position.
If there are no more elements, nil is returned.

accessing
o  contents
return the contents as written so far;
redefined to prevent confusion resulting due to
my superclasses optimization. (see WriteStream contents).
ST80 users if RWStream expect the contents array to remain
unchanged.

o  reset
set the read position to the beginning of the collection

converting
o  readStream
return the receiver as a readStream - thats myself

o  readStreamOrNil
return a readStream from the receiver. Since this is already
a readStream, return self.

This method has been defined for protocol copmatibility with Filename

initialization
o  with: initialCollection
redefined from WriteStream, to position to the beginning of the stream

queries
o  isReadable
return true if the receiver supports reading - thats true

o  size
return the number of elements in the streamed collection.


Examples:


|s| s := ReadWriteStream with:'abcd'. s reset. s nextPut:$A. s contents

ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 20:50:52 GMT