equal
deleted
inserted
replaced
1 "{ Encoding: utf8 }" |
|
2 |
|
3 " |
1 " |
4 COPYRIGHT (c) 2004 by eXept Software AG |
2 COPYRIGHT (c) 2004 by eXept Software AG |
5 All Rights Reserved |
3 All Rights Reserved |
6 |
4 |
7 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
53 ^ (self basicNew) stream:streamArg; encoder:encoder |
51 ^ (self basicNew) stream:streamArg; encoder:encoder |
54 |
52 |
55 " |
53 " |
56 |s| |
54 |s| |
57 s := EncodedStream stream:Transcript encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode). |
55 s := EncodedStream stream:Transcript encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode). |
58 s nextPutAll:('öäü' utf8Encoded) |
56 s nextPutAll:('öäü' utf8Encoded) |
59 |
57 |
60 |s| |
58 |s| |
61 s := EncodedStream stream:('öäü' readStream) encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode). |
59 s := EncodedStream stream:('öäü' readStream) encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode). |
62 s next:3 |
60 s next:3 |
63 " |
61 " |
64 |
62 |
65 "Modified (comment): / 17-01-2018 / 13:36:28 / stefan" |
63 "Modified (comment): / 17-01-2018 / 13:36:28 / stefan" |
66 ! |
64 ! |
70 |
68 |
71 " |
69 " |
72 |baseStream s| |
70 |baseStream s| |
73 baseStream := '' readWriteStream. |
71 baseStream := '' readWriteStream. |
74 s := EncodedStream stream:baseStream encoding:#utf8. |
72 s := EncodedStream stream:baseStream encoding:#utf8. |
75 s nextPutAll:'öäü'. |
73 s nextPutAll:'öäü'. |
76 baseStream reset; contents. |
74 baseStream reset; contents. |
77 |
75 |
78 s contents |
76 s contents |
79 " |
77 " |
80 |
78 |
227 ^ chunk. |
225 ^ chunk. |
228 |
226 |
229 "Modified (format): / 04-01-2018 / 00:33:57 / stefan" |
227 "Modified (format): / 04-01-2018 / 00:33:57 / stefan" |
230 ! ! |
228 ! ! |
231 |
229 |
|
230 !EncodedStream methodsFor:'obsolete positioning'! |
|
231 |
|
232 position0Based |
|
233 <resource: #obsolete> |
|
234 "to be obsoleted - use position" |
|
235 |
|
236 ^ stream position |
|
237 ! |
|
238 |
|
239 position1Based |
|
240 <resource: #obsolete> |
|
241 "to be obsoleted - use position" |
|
242 |
|
243 ^ stream position1Based |
|
244 |
|
245 "Modified: / 02-01-2018 / 20:00:57 / stefan" |
|
246 ! ! |
|
247 |
232 !EncodedStream methodsFor:'queries'! |
248 !EncodedStream methodsFor:'queries'! |
233 |
249 |
234 contentsSpecies |
250 contentsSpecies |
235 ^ String |
251 ^ String |
236 |
252 |
240 |
256 |
241 isEncoderFor:encodingString |
257 isEncoderFor:encodingString |
242 ^ encoder isEncoderFor:encodingString |
258 ^ encoder isEncoderFor:encodingString |
243 |
259 |
244 "Created: / 13-03-2017 / 11:20:20 / stefan" |
260 "Created: / 13-03-2017 / 11:20:20 / stefan" |
|
261 ! ! |
|
262 |
|
263 !EncodedStream methodsFor:'reading'! |
|
264 |
|
265 next |
|
266 peekChar notNil ifTrue:[ |
|
267 |p| |
|
268 p := peekChar. |
|
269 peekChar := nil. |
|
270 ^ p. |
|
271 ]. |
|
272 ^ encoder readNextCharacterFrom:stream |
|
273 |
|
274 "Created: / 14-06-2005 / 17:01:39 / janfrog" |
|
275 "Modified: / 02-01-2018 / 19:19:29 / stefan" |
245 ! ! |
276 ! ! |
246 |
277 |
247 !EncodedStream methodsFor:'stream protocol'! |
278 !EncodedStream methodsFor:'stream protocol'! |
248 |
279 |
249 atEnd |
280 atEnd |
303 ^ stream isEmptyOrNil. |
334 ^ stream isEmptyOrNil. |
304 |
335 |
305 "Modified: / 02-01-2018 / 19:59:09 / stefan" |
336 "Modified: / 02-01-2018 / 19:59:09 / stefan" |
306 ! |
337 ! |
307 |
338 |
308 next |
|
309 peekChar notNil ifTrue:[ |
|
310 |p| |
|
311 p := peekChar. |
|
312 peekChar := nil. |
|
313 ^ p. |
|
314 ]. |
|
315 ^ encoder readNextCharacterFrom:stream |
|
316 |
|
317 "Created: / 14-06-2005 / 17:01:39 / janfrog" |
|
318 "Modified: / 02-01-2018 / 19:19:29 / stefan" |
|
319 ! |
|
320 |
|
321 next:nCharactersToRead |
339 next:nCharactersToRead |
322 |chars| |
340 |chars| |
323 |
341 |
324 nCharactersToRead == 1 ifTrue:[ |
342 nCharactersToRead == 1 ifTrue:[ |
325 ^ self next. |
343 ^ self next. |
392 ^ pos. |
410 ^ pos. |
393 |
411 |
394 "Modified: / 15-01-2018 / 22:42:01 / stefan" |
412 "Modified: / 15-01-2018 / 22:42:01 / stefan" |
395 ! |
413 ! |
396 |
414 |
397 position0Based |
|
398 <resource: #obsolete> |
|
399 "to be obsoleted - use position" |
|
400 |
|
401 ^ stream position |
|
402 ! |
|
403 |
|
404 position0Based:newPosition |
415 position0Based:newPosition |
405 <resource: #obsolete> |
416 <resource: #obsolete> |
406 "to be obsoleted - use position" |
417 "to be obsoleted - use position" |
407 |
418 |
408 stream position:newPosition |
419 stream position:newPosition |
409 ! |
|
410 |
|
411 position1Based |
|
412 <resource: #obsolete> |
|
413 "to be obsoleted - use position" |
|
414 |
|
415 ^ stream position1Based |
|
416 |
|
417 "Modified: / 02-01-2018 / 20:00:57 / stefan" |
|
418 ! |
420 ! |
419 |
421 |
420 position1Based:newPosition |
422 position1Based:newPosition |
421 <resource: #obsolete> |
423 <resource: #obsolete> |
422 "to be obsoleted - use position" |
424 "to be obsoleted - use position" |