equal
deleted
inserted
replaced
14 "{ Package: 'stx:libbasic' }" |
14 "{ Package: 'stx:libbasic' }" |
15 |
15 |
16 "{ NameSpace: Smalltalk }" |
16 "{ NameSpace: Smalltalk }" |
17 |
17 |
18 PeekableStream subclass:#EncodedStream |
18 PeekableStream subclass:#EncodedStream |
19 instanceVariableNames:'encoder stream peekChar positionOfStreamBeforeLast' |
19 instanceVariableNames:'encoder stream peekChar' |
20 classVariableNames:'' |
20 classVariableNames:'' |
21 poolDictionaries:'' |
21 poolDictionaries:'' |
22 category:'Collections-Text-Encodings' |
22 category:'Collections-Text-Encodings' |
23 ! |
23 ! |
24 |
24 |
310 |p| |
310 |p| |
311 p := peekChar. |
311 p := peekChar. |
312 peekChar := nil. |
312 peekChar := nil. |
313 ^ p. |
313 ^ p. |
314 ]. |
314 ]. |
315 positionOfStreamBeforeLast := stream position. |
|
316 ^ encoder readNextCharacterFrom:stream |
315 ^ encoder readNextCharacterFrom:stream |
317 |
316 |
318 "Created: / 14-06-2005 / 17:01:39 / janfrog" |
317 "Created: / 14-06-2005 / 17:01:39 / janfrog" |
319 "Modified: / 02-01-2018 / 19:19:29 / stefan" |
318 "Modified: / 02-01-2018 / 19:19:29 / stefan" |
320 ! |
319 ! |
451 |
450 |
452 "Created: / 31-08-2012 / 16:52:40 / cg" |
451 "Created: / 31-08-2012 / 16:52:40 / cg" |
453 ! |
452 ! |
454 |
453 |
455 skip:nrToSkip |
454 skip:nrToSkip |
456 "sigh: this positions the underlying stream, ignoring any encodings" |
455 "/ can only skip forward |
457 |
456 nrToSkip < 0 ifTrue:[ |
458 "/ can only skip backward by one single character |
457 self proceedableError:'cannot position backwards'. |
459 nrToSkip == -1 ifTrue:[ |
|
460 stream position:positionOfStreamBeforeLast. |
|
461 peekChar := nil. |
|
462 ^ self. |
458 ^ self. |
463 ]. |
459 ]. |
464 self breakPoint:#cg info:'possibly wrong positioning'. |
460 nrToSkip timesRepeat:[self next] |
465 stream position:(stream position + nrToSkip). |
|
466 ! |
461 ! |
467 |
462 |
468 sync |
463 sync |
469 stream sync |
464 stream sync |
470 ! |
465 ! |