-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
GRUtf8CodecStream
nextPutAll: aString
"conversion of smaller string is faster if not using the changeClassTo: trick"
binary
ifTrue: [ stream nextPutAll: aString asString ]
ifFalse: [ aString size > 8
ifTrue: [ stream nextPutAll: (aString encodeAsUTF8 changeClassTo: String) ]
ifFalse: [ | enc str | enc := aString encodeAsUTF8.
str := String new: enc size.
1 to: enc size do: [:idx | str at: idx put: (Character value: (enc at: idx)) ].
stream nextPutAll: str ] ]
GRUtf8CodecStream
nextPut: aCharacter
"old implementation is very slow !!"
" self nextPutAll: (String with: aCharacter)"
| codePoint |
codePoint := aCharacter codePoint.
codePoint > 127
ifTrue: [
codePoint > 255
ifTrue: [ | enc str |
enc := (String with: aCharacter) encodeAsUTF8.
str := String new: enc size.
1 to: enc size do: [:idx | str at: idx put: (Character value: (enc at: idx)) ].
stream nextPutAll: str ]
ifFalse: [ stream nextPutAll: (Latin1ToUtf8Encodings at: codePoint + 1) ] ]
ifFalse: [ stream nextPut: aCharacter ]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels