author | mkobetic |
Mon, 21 Nov 2011 06:44:00 +0000 | |
changeset 25 | 02e7c3b6f63c |
parent 9 | 6c90659cf105 |
child 39 | 80fdc4602b14 |
permissions | -rw-r--r-- |
9 | 1 |
"{ Package: 'stx:goodies/xtreams/terminals' }" |
2 |
||
3 |
"{ NameSpace: Xtreams }" |
|
4 |
||
5 |
WriteStream subclass:#CollectionWriteStream |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
25
02e7c3b6f63c
added XtreamsPool to fix DefaultBufferSize; set proper category names
mkobetic
parents:
9
diff
changeset
|
9 |
category:'Xtreams-Terminals' |
9 | 10 |
! |
11 |
||
12 |
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. |
|
13 |
{{{ |
|
14 |
String new writing write: ''Hello World''; -- 6; close; terminal |
|
15 |
}}} |
|
16 |
||
17 |
Instance Variables |
|
18 |
position <Integer> current position of the stream |
|
19 |
length <Integer> number of valid elements in the destination |
|
20 |
||
21 |
' |
|
22 |
! |
|
23 |
||
24 |
||
25 |
!CollectionWriteStream methodsFor:'accessing'! |
|
26 |
||
27 |
put: anObject |
|
28 |
destination add: anObject |
|
29 |
! |
|
30 |
||
31 |
write: anInteger from: aSequenceableCollection at: startIndex |
|
32 |
startIndex to: startIndex + anInteger - 1 do: [:index | |
|
33 |
destination add: (aSequenceableCollection at: index)]. |
|
34 |
^anInteger |
|
35 |
! ! |
|
36 |
||
37 |
!CollectionWriteStream methodsFor:'initialize-release'! |
|
38 |
||
39 |
close |
|
40 |
! |
|
41 |
||
42 |
contentsSpecies |
|
43 |
^destination species |
|
44 |
! |
|
45 |
||
46 |
flush |
|
47 |
! ! |
|
48 |
||
49 |
!CollectionWriteStream class methodsFor:'documentation'! |
|
50 |
||
51 |
version_SVN |
|
52 |
^ '$Id$' |
|
53 |
! ! |