author | Martin Kobetic |
Sun, 17 Nov 2013 00:23:18 -0500 | |
changeset 147 | bd6be28aa924 |
parent 111 | 44ac233b2f83 |
permissions | -rw-r--r-- |
10 | 1 |
"{ Package: 'stx:goodies/xtreams/transforms' }" |
2 |
||
3 |
"{ NameSpace: Xtreams }" |
|
4 |
||
5 |
Encoder subclass:#ASCIIEncoder |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
27
2cc5a8a3ca14
added XtreamsPool to fix DefaultBufferSize; set proper category names
mkobetic
parents:
10
diff
changeset
|
9 |
category:'Xtreams-Transforms' |
10 | 10 |
! |
11 |
||
12 |
ASCIIEncoder comment:'Implements ASCII encoding. |
|
13 |
||
14 |
' |
|
15 |
! |
|
16 |
||
17 |
||
18 |
!ASCIIEncoder class methodsFor:'class initialization'! |
|
19 |
||
20 |
initialize |
|
21 |
||
22 |
self encoders |
|
23 |
at: #ascii put: self new; |
|
24 |
at: #ASCII put: self new |
|
25 |
! ! |
|
26 |
||
27 |
!ASCIIEncoder methodsFor:'accessing'! |
|
28 |
||
29 |
decodeFrom: aReadStream |
|
30 |
||
31 |
| value | |
|
32 |
^(value := aReadStream get) < 128 |
|
33 |
ifTrue: [ Character value: value ] |
|
34 |
ifFalse: [ self error: 'Illegal value!!' ] |
|
35 |
! |
|
36 |
||
37 |
encode: aCharacter on: aWriteStream |
|
38 |
||
39 |
| value | |
|
40 |
(value := aCharacter asInteger) < 128 |
|
41 |
ifTrue: [ aWriteStream put: value ] |
|
42 |
ifFalse: [ self error: 'Illegal character!!' ] |
|
43 |
! ! |
|
44 |
||
45 |
!ASCIIEncoder class methodsFor:'documentation'! |
|
46 |
||
111
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
47 |
version_HG |
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
48 |
|
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
49 |
^ '$Changeset: <not expanded> $' |
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
50 |
! |
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
51 |
|
10 | 52 |
version_SVN |
53 |
^ '$Id$' |
|
54 |
! ! |
|
55 |
||
111
44ac233b2f83
* removed namespace from pool references and stray extension methods
joe
parents:
72
diff
changeset
|
56 |
|
10 | 57 |
ASCIIEncoder initialize! |