"{ Package: 'stx:goodies/xtreams/terminals' }"
"{ NameSpace: Xtreams }"
WriteStream subclass:#CollectionWriteStream
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Xtreams-Terminals'
!
CollectionWriteStream comment:'Write stream on a sequenceable collection. The collection is grown automatically to accommodate any elements written. Closing a collection write stream will truncate the collection to the current stream position. This behavior is useful as a replacement for the traditional #contents message. The contents can be accessed with the #terminal message after the stream is closed.
{{{
String new writing write: ''Hello World''; -- 6; close; terminal
}}}
Instance Variables
position <Integer> current position of the stream
length <Integer> number of valid elements in the destination
'
!
!CollectionWriteStream methodsFor:'accessing'!
put: anObject
destination add: anObject
!
write: anInteger from: aSequenceableCollection at: startIndex
startIndex to: startIndex + anInteger - 1 do: [:index |
destination add: (aSequenceableCollection at: index)].
^anInteger
! !
!CollectionWriteStream methodsFor:'initialize-release'!
close
!
contentsSpecies
^destination species
!
flush
! !
!CollectionWriteStream class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !