CharacterEncoder.st
changeset 21471 bbf99c77f552
parent 21138 1cc7a2e7ee19
child 21602 c63ec4a97409
equal deleted inserted replaced
21470:a62f56072f60 21471:bbf99c77f552
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2004 by eXept Software AG
     4  COPYRIGHT (c) 2004 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  1384     "given a codePoint in unicode, return a byte in my encoding for it"
  1386     "given a codePoint in unicode, return a byte in my encoding for it"
  1385 
  1387 
  1386     self subclassResponsibility
  1388     self subclassResponsibility
  1387 !
  1389 !
  1388 
  1390 
       
  1391 encodeCharacter:aUnicodeCharacter on:aStream
       
  1392     "given a character in unicode, encode it onto aStream.
       
  1393      Subclasses can redefine this to avoid allocating many new string instances."
       
  1394 
       
  1395     aStream nextPutAll:(self encodeString:aUnicodeCharacter asString).
       
  1396 
       
  1397     "Created: / 16-02-2017 / 16:18:33 / stefan"
       
  1398     "Modified (comment): / 16-02-2017 / 20:41:18 / stefan"
       
  1399 !
       
  1400 
  1389 encodeString:aUnicodeString
  1401 encodeString:aUnicodeString
  1390     "given a string in unicode, return a string in my encoding for it"
  1402     "given a string in unicode, return a string in my encoding for it"
  1391 
  1403 
  1392     |newString myCode uniCodePoint bits 
  1404     |newString myCode uniCodePoint bits 
  1393      stringSize "{ Class: SmallInteger }"|
  1405      stringSize "{ Class: SmallInteger }"|