ReadWriteStream.st
author claus
Fri, 05 Aug 1994 02:59:40 +0200
changeset 93 e31220cb391f
parent 88 81dacba7a63a
child 329 f14fc5ac11b7
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1989 by Claus Gittinger
              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.
"

WriteStream subclass:#ReadWriteStream
       instanceVariableNames:''
       classVariableNames:''
       poolDictionaries:''
       category:'Streams'
!

ReadWriteStream comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
              All Rights Reserved

$Header: /cvs/stx/stx/libbasic/ReadWriteStream.st,v 1.7 1994-08-05 00:59:32 claus Exp $
'!

!ReadWriteStream class methodsFor: 'documentation'!

copyright
"
 COPYRIGHT (c) 1989 by Claus Gittinger
              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.
"
!

version
"
$Header: /cvs/stx/stx/libbasic/ReadWriteStream.st,v 1.7 1994-08-05 00:59:32 claus Exp $
"
!

documentation
"
    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).
"
! !

!ReadWriteStream methodsFor: 'access-reading'!

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

    (position > readLimit) ifTrue:[^ nil].
    ^ collection at:position
!

next
    "return the next element; advance read position.
     If there are no more elements, nil is returned."

    |element|

    (position > readLimit) ifTrue:[^ nil].
    element := collection at:position.
    position := position + 1.
    ^ element
! !