author | Martin Kobetic |
Sun, 17 Nov 2013 00:21:39 -0500 | |
changeset 141 | 263190106319 |
parent 109 | 9587e2df7029 |
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 |
|
109 | 18 |
position <Integer> current position of the stream |
19 |
length <Integer> number of valid elements in the destination |
|
9 | 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 |
||
109 | 51 |
version_HG |
52 |
||
53 |
^ '$Changeset: <not expanded> $' |
|
9 | 54 |
! ! |
109 | 55 |