author | Claus Gittinger <cg@exept.de> |
Thu, 27 Aug 1998 14:34:45 +0200 | |
changeset 3790 | 629791828694 |
parent 3098 | 4203b0d13fc8 |
child 4406 | f78222b250b2 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
252 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
PositionableStream subclass:#WriteStream |
|
1295 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Streams' |
|
1 | 18 |
! |
19 |
||
1965 | 20 |
!WriteStream class methodsFor:'documentation'! |
1 | 21 |
|
88 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
252 | 25 |
All Rights Reserved |
88 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
68 | 36 |
documentation |
37 |
" |
|
2883 | 38 |
Streams for writing into. |
39 |
WriteStreams are especially useful, if big strings are to be constructed |
|
40 |
from pieces - create a writeStream, add the pieces (with #nextPut or |
|
41 |
#nextPutAll) and finally fetch the concatenated string via #contents. |
|
42 |
This is much better than constructing the big string by concatenating via |
|
43 |
the comma (,) operator, since less intermediate garbage objects are created. |
|
44 |
||
45 |
This implementation currently DOES change the |
|
261 | 46 |
identity if the streamed-upon collection IF it cannot grow easily. |
47 |
Collections which cannot grow easily are for example: Array, ByteArray and String. |
|
88 | 48 |
Thus it is slightly incompatible to ST-80 since 'aStream contents' does |
49 |
not always return the original collection. This may change. |
|
1295 | 50 |
|
51 |
[author:] |
|
52 |
Claus Gittinger |
|
68 | 53 |
" |
2883 | 54 |
! |
55 |
||
56 |
examples |
|
57 |
" |
|
58 |
[exBegin] |
|
59 |
|s| |
|
60 |
||
61 |
s := WriteStream on:''. |
|
62 |
s nextPutAll:'hello'; |
|
63 |
space; |
|
64 |
nextPutAll:'world'. |
|
65 |
||
66 |
s contents inspect |
|
67 |
[exEnd] |
|
68 |
||
69 |
[exBegin] |
|
70 |
|s| |
|
71 |
||
72 |
s := WriteStream on:''. |
|
73 |
s nextPutAll:'hello'; |
|
74 |
space; |
|
75 |
nextPutAll:'world'. |
|
76 |
||
77 |
Transcript nextPutLine:(s contents) |
|
78 |
[exEnd] |
|
79 |
||
80 |
[exBegin] |
|
81 |
|s| |
|
82 |
||
83 |
s := '' writeStream. |
|
84 |
s nextPutAll:'hello'; |
|
85 |
space; |
|
86 |
nextPutAll:'world'. |
|
87 |
||
88 |
Transcript nextPutLine:(s contents) |
|
89 |
[exEnd] |
|
90 |
" |
|
91 |
||
345 | 92 |
! ! |
93 |
||
1 | 94 |
!WriteStream methodsFor:'accessing'! |
95 |
||
96 |
contents |
|
345 | 97 |
"return the current contents (a collection) of the stream. |
98 |
Currently, this returns the actual collection if possible |
|
99 |
(and reset is implemented to create a new one) in contrast to |
|
100 |
ST80, where contents returns a copy and reset only sets the writePointer. |
|
101 |
The ST/X behavior creates less temporary garbage in the normal case |
|
2410 | 102 |
(where things are written for the contents only) but may be incompatible |
345 | 103 |
with some applications. Time will show, if this is to be changed." |
1 | 104 |
|
260 | 105 |
|lastIndex| |
106 |
||
107 |
lastIndex := position - 1. |
|
108 |
collection size == lastIndex ifFalse:[ |
|
2410 | 109 |
collection isFixedSize ifTrue:[ |
110 |
" |
|
111 |
grow is expensive - return a copy. |
|
3087 | 112 |
(is this what users of writeStream expect ?) |
2410 | 113 |
" |
114 |
collection := collection copyFrom:1 to:lastIndex |
|
115 |
] ifFalse:[ |
|
116 |
collection grow:lastIndex |
|
117 |
] |
|
1 | 118 |
]. |
119 |
^ collection |
|
2410 | 120 |
|
3087 | 121 |
"Modified: / 19.2.1997 / 08:57:28 / stefan" |
122 |
"Modified: / 30.10.1997 / 16:21:23 / cg" |
|
1 | 123 |
! |
124 |
||
329 | 125 |
reset |
345 | 126 |
"reset the stream; write anew. |
2410 | 127 |
See the comment in WriteStream>>contents" |
329 | 128 |
|
129 |
collection := collection species new:(collection size). |
|
130 |
super reset |
|
2410 | 131 |
|
132 |
"Modified: 19.2.1997 / 08:57:00 / stefan" |
|
1 | 133 |
! ! |
134 |
||
611 | 135 |
!WriteStream methodsFor:'positioning'! |
136 |
||
137 |
position:index |
|
138 |
"redefined to allow positioning past the readLimit" |
|
139 |
||
140 |
((index > (collection size + 1)) or:[index < 0]) ifTrue: [^ self positionError]. |
|
141 |
position := index |
|
142 |
! ! |
|
143 |
||
144 |
!WriteStream methodsFor:'private'! |
|
145 |
||
146 |
growCollection |
|
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
147 |
"grow the streamed collection to at least 10 elements" |
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
148 |
|
611 | 149 |
self growCollection:10 |
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
150 |
|
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
151 |
"Modified: 19.8.1997 / 17:53:28 / cg" |
611 | 152 |
! |
153 |
||
154 |
growCollection:minNewSize |
|
155 |
"grow the streamed collection to at least minNewSize" |
|
156 |
||
157 |
|oldSize newSize newColl| |
|
158 |
||
159 |
oldSize := collection size. |
|
160 |
(oldSize == 0) ifTrue:[ |
|
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
161 |
newSize := minNewSize |
611 | 162 |
] ifFalse:[ |
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
163 |
newSize := oldSize * 2. |
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
164 |
(newSize < minNewSize) ifTrue:[newSize := minNewSize]. |
611 | 165 |
]. |
166 |
collection isFixedSize ifTrue:[ |
|
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
167 |
newColl := collection species new:newSize. |
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
168 |
newColl replaceFrom:1 to:oldSize with:collection startingAt:1. |
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
169 |
collection := newColl |
611 | 170 |
] ifFalse:[ |
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
171 |
collection grow:newSize |
611 | 172 |
]. |
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
173 |
|
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
174 |
"Modified: 19.8.1997 / 17:53:11 / cg" |
611 | 175 |
! ! |
176 |
||
177 |
!WriteStream methodsFor:'private accessing'! |
|
178 |
||
179 |
on:aCollection from:start to:last |
|
180 |
"create and return a new stream for writing onto aCollection, where |
|
181 |
writing is limited to the elements in the range start to last." |
|
182 |
||
183 |
super on:aCollection from:start to:last. |
|
184 |
writeLimit := last. |
|
185 |
! ! |
|
186 |
||
187 |
!WriteStream methodsFor:'queries'! |
|
188 |
||
3031 | 189 |
isEmpty |
190 |
"return true, if the contents of the stream is empty" |
|
191 |
||
192 |
^ position == 1 |
|
193 |
||
194 |
"Created: 14.10.1997 / 20:44:37 / cg" |
|
195 |
! |
|
196 |
||
3098
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
197 |
isReadable |
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
198 |
"return true if the receiver supports reading - thats not true" |
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
199 |
|
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
200 |
^ false |
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
201 |
|
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
202 |
"Created: / 8.11.1997 / 14:06:07 / cg" |
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
203 |
! |
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
204 |
|
611 | 205 |
isWritable |
1405 | 206 |
"return true, if writing is supported by the recevier. |
207 |
Always return true here" |
|
208 |
||
611 | 209 |
^ true |
1405 | 210 |
|
211 |
"Modified: 16.5.1996 / 14:44:49 / cg" |
|
3031 | 212 |
! |
213 |
||
214 |
size |
|
215 |
"return the current size" |
|
216 |
||
217 |
^ position - 1. |
|
218 |
||
219 |
"Created: 14.10.1997 / 20:43:49 / cg" |
|
611 | 220 |
! ! |
221 |
||
63 | 222 |
!WriteStream methodsFor:'reading'! |
1 | 223 |
|
224 |
next |
|
10 | 225 |
"catch read access to write stream - report an error" |
1 | 226 |
|
10 | 227 |
self shouldNotImplement |
1 | 228 |
! |
229 |
||
230 |
peek |
|
10 | 231 |
"catch read access to write stream - report an error" |
1 | 232 |
|
10 | 233 |
self shouldNotImplement |
63 | 234 |
! ! |
235 |
||
611 | 236 |
!WriteStream methodsFor:'writing'! |
369 | 237 |
|
611 | 238 |
next:count put:anObject |
239 |
"append anObject count times to the receiver. |
|
240 |
Redefined to avoid count grows of the underlying collection - |
|
241 |
instead a single grow on the final size is performed." |
|
242 |
||
243 |
|final| |
|
244 |
||
245 |
(collection isNil or:[writeLimit notNil]) ifTrue:[ |
|
246 |
^ super next:count put:anObject |
|
247 |
]. |
|
369 | 248 |
|
611 | 249 |
final := position + count - 1. |
250 |
(final > collection size) ifTrue:[ |
|
251 |
self growCollection:final |
|
252 |
]. |
|
369 | 253 |
|
611 | 254 |
position to:final do:[:index | |
255 |
collection at:index put:anObject. |
|
256 |
]. |
|
257 |
position := position + count. |
|
258 |
(position > readLimit) ifTrue:[readLimit := position - 1]. |
|
259 |
^ anObject |
|
260 |
! |
|
1 | 261 |
|
262 |
nextPut:anObject |
|
1584 | 263 |
"append the argument, anObject to the stream. |
2863
aec08a0c2c2e
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
264 |
Specially tuned for appending to String, ByteArray and Array streams." |
1 | 265 |
|
63 | 266 |
%{ /* NOCONTEXT */ |
267 |
||
268 |
REGISTER int pos; |
|
269 |
unsigned ch; |
|
270 |
OBJ coll; |
|
2883 | 271 |
OBJ p, wL, rL; |
1584 | 272 |
int __readLimit = -1; |
63 | 273 |
|
1136 | 274 |
coll = __INST(collection); |
275 |
p = __INST(position); |
|
63 | 276 |
|
2894 | 277 |
#ifndef NO_PRIM_STREAM |
293 | 278 |
if (__isNonNilObject(coll) && __isSmallInteger(p)) { |
1584 | 279 |
pos = __intVal(p); |
2883 | 280 |
wL = __INST(writeLimit); |
68 | 281 |
|
2883 | 282 |
if ((wL == nil) |
283 |
|| (__isSmallInteger(wL) && (pos <= __intVal(wL)))) { |
|
1584 | 284 |
OBJ cls; |
63 | 285 |
|
1584 | 286 |
cls = __qClass(coll); |
252 | 287 |
|
1584 | 288 |
rL = __INST(readLimit); |
289 |
if (__isSmallInteger(rL)) { |
|
290 |
__readLimit = __intVal(rL); |
|
291 |
} |
|
293 | 292 |
|
1584 | 293 |
if (cls == @global(String)) { |
294 |
if (__isCharacter(anObject) |
|
2883 | 295 |
&& ((ch = __intVal(__characterVal(anObject))) <= 255) /* ch is unsigned */ |
1584 | 296 |
&& (pos <= __stringSize(coll))) { |
2883 | 297 |
__StringInstPtr(coll)->s_element[pos-1] = ch; |
298 |
__INST(position) = __MKSMALLINT(pos + 1); |
|
299 |
if ((__readLimit >= 0) && (pos >= __readLimit)) { |
|
300 |
__INST(readLimit) = __MKSMALLINT(pos); |
|
1584 | 301 |
} |
2883 | 302 |
RETURN ( anObject ); |
1584 | 303 |
} |
304 |
} else if (cls == @global(ByteArray)) { |
|
305 |
if (__isSmallInteger(anObject) |
|
2864
328b52ecd339
no need for unsigned compare against 0
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
306 |
&& ((ch = __intVal(anObject)) <= 255) /* ch is unsigned */ |
2883 | 307 |
&& (pos <= __byteArraySize(coll))) { |
1584 | 308 |
__ByteArrayInstPtr(coll)->ba_element[pos-1] = ch; |
309 |
__INST(position) = __MKSMALLINT(pos + 1); |
|
310 |
if ((__readLimit >= 0) && (pos >= __readLimit)) { |
|
311 |
__INST(readLimit) = __MKSMALLINT(pos); |
|
312 |
} |
|
313 |
RETURN ( anObject ); |
|
314 |
} |
|
315 |
} else if (cls == @global(Array)) { |
|
2883 | 316 |
if (pos <= __arraySize(coll)) { |
1584 | 317 |
__ArrayInstPtr(coll)->a_element[pos-1] = anObject; |
318 |
__STORE(coll, anObject); |
|
319 |
__INST(position) = __MKSMALLINT(pos + 1); |
|
320 |
if ((__readLimit >= 0) && (pos >= __readLimit)) { |
|
321 |
__INST(readLimit) = __MKSMALLINT(pos); |
|
322 |
} |
|
323 |
RETURN ( anObject ); |
|
324 |
} |
|
325 |
} |
|
326 |
} |
|
63 | 327 |
} |
2894 | 328 |
#endif |
260 | 329 |
%}. |
293 | 330 |
(writeLimit isNil |
331 |
or:[position <= writeLimit]) ifTrue:[ |
|
1584 | 332 |
(position > collection size) ifTrue:[self growCollection]. |
333 |
collection at:position put:anObject. |
|
334 |
(position > readLimit) ifTrue:[readLimit := position]. |
|
335 |
position := position + 1. |
|
838 | 336 |
] ifFalse:[ |
1965 | 337 |
WriteErrorSignal raiseErrorString:'write beyond writeLimit' |
293 | 338 |
]. |
1 | 339 |
^anObject |
340 |
! |
|
341 |
||
342 |
nextPutAll:aCollection |
|
63 | 343 |
"append all elements of the argument, aCollection to the stream. |
344 |
Redefined to avoid count grows of the underlying collection - |
|
345 |
instead a single grow on the final size is performed." |
|
1 | 346 |
|
347 |
|nMore final| |
|
348 |
||
77 | 349 |
collection isNil ifTrue:[ |
260 | 350 |
^ super nextPutAll:aCollection |
77 | 351 |
]. |
352 |
||
1 | 353 |
nMore := aCollection size. |
354 |
final := position + nMore - 1. |
|
293 | 355 |
(writeLimit notNil |
356 |
and:[final > writeLimit]) ifTrue:[ |
|
357 |
final := writeLimit. |
|
358 |
nMore := final - position + 1 |
|
359 |
]. |
|
1 | 360 |
(final > collection size) ifTrue:[ |
252 | 361 |
self growCollection:final |
1 | 362 |
]. |
363 |
collection replaceFrom:position |
|
252 | 364 |
to:final |
365 |
with:aCollection |
|
366 |
startingAt:1. |
|
1 | 367 |
|
368 |
position := position + nMore. |
|
369 |
(position > readLimit) ifTrue:[readLimit := position - 1]. |
|
370 |
^ aCollection |
|
1539
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
371 |
! |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
372 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
373 |
nextPutAll:aCollection startingAt:pos1 to:pos2 |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
374 |
"append some elements of the argument, aCollection to the stream. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
375 |
Redefined to avoid count grows of the underlying collection - |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
376 |
instead a single grow on the final size is performed." |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
377 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
378 |
|nMore final| |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
379 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
380 |
collection isNil ifTrue:[ |
1541 | 381 |
^ super nextPutAll:aCollection startingAt:pos1 to:pos2 |
1539
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
382 |
]. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
383 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
384 |
nMore := pos2 - pos1 + 1. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
385 |
final := position + nMore - 1. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
386 |
(writeLimit notNil |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
387 |
and:[final > writeLimit]) ifTrue:[ |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
388 |
final := writeLimit. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
389 |
nMore := final - position + 1 |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
390 |
]. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
391 |
(final > collection size) ifTrue:[ |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
392 |
self growCollection:final |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
393 |
]. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
394 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
395 |
collection replaceFrom:position |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
396 |
to:final |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
397 |
with:aCollection |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
398 |
startingAt:pos1. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
399 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
400 |
position := position + nMore. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
401 |
(position > readLimit) ifTrue:[readLimit := position - 1]. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
402 |
^ aCollection |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
403 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
404 |
" |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
405 |
|s| |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
406 |
|
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
407 |
s := '' writeStream. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
408 |
s nextPutAll:'hello '. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
409 |
s nextPutAll:'1234world012345' startingAt:5 to:9. |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
410 |
s contents |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
411 |
" |
b1ac096a81e3
added #nextPutAll:startingAt:to:
Claus Gittinger <cg@exept.de>
parents:
1405
diff
changeset
|
412 |
|
1541 | 413 |
"Modified: 12.7.1996 / 10:31:36 / cg" |
1 | 414 |
! ! |
415 |
||
1965 | 416 |
!WriteStream class methodsFor:'documentation'! |
701 | 417 |
|
418 |
version |
|
3098
4203b0d13fc8
added #isReadable (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3087
diff
changeset
|
419 |
^ '$Header: /cvs/stx/stx/libbasic/Attic/WriteStr.st,v 1.41 1997-11-11 14:04:11 cg Exp $' |
701 | 420 |
! ! |