smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

GSMNumberDigit: Make this code work on Pharo

* Use WriteStream>>#contents instead of the OrderedCollection>>#asString
* Character eof does not exist.. use any other character for the marking
This commit is contained in:
Holger Hans Peter Freyther 2013-08-14 14:06:28 +02:00
parent 6a12deef01
commit ac5b3c08fc
1 changed files with 6 additions and 6 deletions

View File

@ -1538,7 +1538,7 @@ Object subclass: GSMNumberDigits [
digitMap at: 13 put: $a.
digitMap at: 14 put: $b.
digitMap at: 15 put: $c.
digitMap at: 16 put: Character eof.
digitMap at: 16 put: $Z.
digitMap yourself.
].
]
@ -1563,23 +1563,23 @@ Object subclass: GSMNumberDigits [
| str |
<category: 'decoding'>
str := OrderedCollection new.
str := WriteStream on: String new.
[aStream atEnd] whileFalse: [
| in tmp char |
in := aStream next.
tmp := in bitAnd: 16r0F.
str add: (self mapDigit: tmp).
str nextPut: (self mapDigit: tmp).
tmp := (in bitAnd: 16rF0) bitShift: -4.
char := (self mapDigit: tmp).
char = Character eof
char = $Z
ifFalse: [
str add: char.
str nextPut: char.
].
].
^ str asString
^ str contents
]
GSMNumberDigits class >> encodeFrom: aNumber [