#DOCUMENTATION by cg
class: EncodedStream
category of:
#next
#position0Based
#position1Based
--- a/EncodedStream.st Mon Nov 18 17:26:13 2019 +0100
+++ b/EncodedStream.st Mon Nov 18 17:43:34 2019 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 2004 by eXept Software AG
All Rights Reserved
@@ -55,10 +53,10 @@
"
|s|
s := EncodedStream stream:Transcript encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode).
- s nextPutAll:('öäü' utf8Encoded)
+ s nextPutAll:('öäü' utf8Encoded)
|s|
- s := EncodedStream stream:('öäü' readStream) encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode).
+ s := EncodedStream stream:('öäü' readStream) encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode).
s next:3
"
@@ -72,7 +70,7 @@
|baseStream s|
baseStream := '' readWriteStream.
s := EncodedStream stream:baseStream encoding:#utf8.
- s nextPutAll:'öäü'.
+ s nextPutAll:'öäü'.
baseStream reset; contents.
s contents
@@ -229,6 +227,24 @@
"Modified (format): / 04-01-2018 / 00:33:57 / stefan"
! !
+!EncodedStream methodsFor:'obsolete positioning'!
+
+position0Based
+ <resource: #obsolete>
+ "to be obsoleted - use position"
+
+ ^ stream position
+!
+
+position1Based
+ <resource: #obsolete>
+ "to be obsoleted - use position"
+
+ ^ stream position1Based
+
+ "Modified: / 02-01-2018 / 20:00:57 / stefan"
+! !
+
!EncodedStream methodsFor:'queries'!
contentsSpecies
@@ -244,6 +260,21 @@
"Created: / 13-03-2017 / 11:20:20 / stefan"
! !
+!EncodedStream methodsFor:'reading'!
+
+next
+ peekChar notNil ifTrue:[
+ |p|
+ p := peekChar.
+ peekChar := nil.
+ ^ p.
+ ].
+ ^ encoder readNextCharacterFrom:stream
+
+ "Created: / 14-06-2005 / 17:01:39 / janfrog"
+ "Modified: / 02-01-2018 / 19:19:29 / stefan"
+! !
+
!EncodedStream methodsFor:'stream protocol'!
atEnd
@@ -305,19 +336,6 @@
"Modified: / 02-01-2018 / 19:59:09 / stefan"
!
-next
- peekChar notNil ifTrue:[
- |p|
- p := peekChar.
- peekChar := nil.
- ^ p.
- ].
- ^ encoder readNextCharacterFrom:stream
-
- "Created: / 14-06-2005 / 17:01:39 / janfrog"
- "Modified: / 02-01-2018 / 19:19:29 / stefan"
-!
-
next:nCharactersToRead
|chars|
@@ -394,13 +412,6 @@
"Modified: / 15-01-2018 / 22:42:01 / stefan"
!
-position0Based
- <resource: #obsolete>
- "to be obsoleted - use position"
-
- ^ stream position
-!
-
position0Based:newPosition
<resource: #obsolete>
"to be obsoleted - use position"
@@ -408,15 +419,6 @@
stream position:newPosition
!
-position1Based
- <resource: #obsolete>
- "to be obsoleted - use position"
-
- ^ stream position1Based
-
- "Modified: / 02-01-2018 / 20:00:57 / stefan"
-!
-
position1Based:newPosition
<resource: #obsolete>
"to be obsoleted - use position"