240 This is only allowed, if the receiver supports writing." |
240 This is only allowed, if the receiver supports writing." |
241 |
241 |
242 self nextPut:(Character nl) |
242 self nextPut:(Character nl) |
243 ! ! |
243 ! ! |
244 |
244 |
245 !Stream methodsFor:'JS syntactic sugar'! |
|
246 |
|
247 log:something |
|
248 "same as showCR:. |
|
249 Added to allow for Transcript.log(...) to be used in a similar way as |
|
250 console.log(...). |
|
251 Not for non-JavaScript usage" |
|
252 |
|
253 self showCR:something. |
|
254 |
|
255 "Created: / 30-08-2018 / 13:29:50 / Claus Gittinger" |
|
256 ! ! |
|
257 |
245 |
258 !Stream methodsFor:'accessing'! |
246 !Stream methodsFor:'accessing'! |
259 |
247 |
260 contents |
248 contents |
261 "return the entire contents of the stream. |
249 "return the entire contents of the stream. |
2093 ByteArray streamContents:[:s| |
2081 ByteArray streamContents:[:s| |
2094 s nextPutAllUtf8:'hallo' |
2082 s nextPutAllUtf8:'hallo' |
2095 ]. |
2083 ]. |
2096 |
2084 |
2097 String streamContents:[:s| |
2085 String streamContents:[:s| |
2098 s nextPutAllUtf8:'abcdeäöüß' asUnicode32String |
2086 s nextPutAllUtf8:'abcdeäöüÃ' asUnicode32String |
2099 ]. |
2087 ]. |
2100 . |
2088 . |
2101 ByteArray streamContents:[:s| |
2089 ByteArray streamContents:[:s| |
2102 s nextPutAllUtf8:'abcdeäöüß' asUnicode32String |
2090 s nextPutAllUtf8:'abcdeäöüÃ' asUnicode32String |
2103 ]. |
2091 ]. |
2104 |
2092 |
2105 '/tmp/bytes' asFilename writingFileDo:[:s| |
2093 '/tmp/bytes' asFilename writingFileDo:[:s| |
2106 s nextPutAllUtf8:'abcdeäöüß' |
2094 s nextPutAllUtf8:'abcdeäöüÃ' |
2107 ]. |
2095 ]. |
2108 " |
2096 " |
2109 |
2097 |
2110 "Modified (format): / 16-02-2017 / 20:28:52 / stefan" |
2098 "Modified (format): / 16-02-2017 / 20:28:52 / stefan" |
2111 ! |
2099 ! |
2547 ]. |
2535 ]. |
2548 |
2536 |
2549 " |
2537 " |
2550 (#[] writeStream |
2538 (#[] writeStream |
2551 nextPutUtf16Bytes:$B MSB:true; |
2539 nextPutUtf16Bytes:$B MSB:true; |
2552 nextPutUtf16Bytes:$Ä MSB:true; |
2540 nextPutUtf16Bytes:$Ã MSB:true; |
2553 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true; |
2541 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true; |
2554 contents) |
2542 contents) |
2555 |
2543 |
2556 ('' writeStream |
2544 ('' writeStream |
2557 nextPutUtf16Bytes:$B MSB:true; |
2545 nextPutUtf16Bytes:$B MSB:true; |
2558 nextPutUtf16Bytes:$Ä MSB:true; |
2546 nextPutUtf16Bytes:$Ã MSB:true; |
2559 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true; |
2547 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true; |
2560 contents) |
2548 contents) |
2561 |
2549 |
2562 (FileStream newTemporary |
2550 (FileStream newTemporary |
2563 nextPutUtf16Bytes:$B MSB:false; |
2551 nextPutUtf16Bytes:$B MSB:false; |
2564 nextPutUtf16Bytes:$Ä MSB:false; |
2552 nextPutUtf16Bytes:$Ã MSB:false; |
2565 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:false; |
2553 nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:false; |
2566 reset; |
2554 reset; |
2567 binary; |
2555 binary; |
2568 contents) |
2556 contents) |
2569 " |
2557 " |
2671 EncodingError raiseWith:aCharacter errorString:'codePoint > 31bit in #nextPutUtf8:'. |
2659 EncodingError raiseWith:aCharacter errorString:'codePoint > 31bit in #nextPutUtf8:'. |
2672 |
2660 |
2673 " |
2661 " |
2674 (String streamContents:[:s| |
2662 (String streamContents:[:s| |
2675 s nextPutUtf8:$a. |
2663 s nextPutUtf8:$a. |
2676 s nextPutUtf8:$ü. |
2664 s nextPutUtf8:$ü. |
2677 s nextPutUtf8: (Character value:16r1fff). |
2665 s nextPutUtf8: (Character value:16r1fff). |
2678 s nextPutUtf8: (Character value:16rffff). |
2666 s nextPutUtf8: (Character value:16rffff). |
2679 s nextPutUtf8: (Character value:16r1ffffff). |
2667 s nextPutUtf8: (Character value:16r1ffffff). |
2680 s nextPutUtf8: (Character value:16r800). |
2668 s nextPutUtf8: (Character value:16r800). |
2681 ]) |
2669 ]) |
4208 "append the elements with index from first to last |
4196 "append the elements with index from first to last |
4209 of the argument, aCollection onto the receiver. |
4197 of the argument, aCollection onto the receiver. |
4210 This is only allowed, if the receiver supports writing." |
4198 This is only allowed, if the receiver supports writing." |
4211 |
4199 |
4212 aCollection from:first to:last do:[:element | |
4200 aCollection from:first to:last do:[:element | |
4213 self nextPut:element |
4201 self nextPut:element |
4214 ]. |
4202 ]. |
4215 ^ aCollection |
|
4216 |
4203 |
4217 " |
4204 " |
4218 |s| |
4205 |s| |
4219 |
4206 |
4220 s := WriteStream on:#(). |
4207 s := WriteStream on:#(). |
4221 s nextPutAll:#('one' 'two' 'three' 'four' 'five') startingAt:2 to:4. |
4208 s nextPutAll:#('one' 'two' 'three' 'four' 'five') startingAt:2 to:4. |
4222 s contents |
4209 s contents |
4223 " |
4210 " |
4224 |
4211 |
4225 "Modified: 11.7.1996 / 10:00:32 / cg" |
4212 "Modified: / 11-07-1996 / 10:00:32 / cg" |
|
4213 "Modified: / 22-11-2018 / 12:52:25 / Stefan Vogel" |
4226 ! |
4214 ! |
4227 |
4215 |
4228 nextPutAllLines:aCollectionOfStrings |
4216 nextPutAllLines:aCollectionOfStrings |
4229 "put all elements of the argument, aCollection as individual lines |
4217 "put all elements of the argument, aCollection as individual lines |
4230 onto the receiver, append a cr (carriage return) after each. |
4218 onto the receiver, append a cr (carriage return) after each. |