author | mkobetic |
Sun, 15 Jan 2012 22:51:20 +0000 | |
changeset 53 | 3a3d798e73b5 |
parent 47 | b92b6ee7b460 |
child 57 | 83d1a5856145 |
permissions | -rw-r--r-- |
53 | 1 |
'From Smalltalk/X, Version:6.2.1 on 15-01-2012 at 05:49:26 PM' ! |
38 | 2 |
|
6 | 3 |
"{ Package: 'stx:goodies/xtreams/support' }" |
4 |
||
5 |
"{ NameSpace: Xtreams }" |
|
6 |
||
7 |
Object subclass:#Encoder |
|
8 |
instanceVariableNames:'' |
|
9 |
classVariableNames:'DialectEncoder Encoders' |
|
10 |
poolDictionaries:'' |
|
24
f906c95ca2ed
added XtreamsPool to fix DefaultBufferSize; set proper category names
mkobetic
parents:
6
diff
changeset
|
11 |
category:'Xtreams-Support' |
6 | 12 |
! |
13 |
||
14 |
Encoder comment:'Abstract character encoder class defines the API and maintains a registry of known encoders (Encoders). Also provides a hook to allow plugging in dialect specific encoders (DialectEncoder) as a secondary encoder resource. |
|
15 |
||
16 |
Shared Variables |
|
17 |
DialectEncoder <Class> optional dialect specific encoder class providing support for additional encodings |
|
18 |
Encoders <Dictionary key: Symbol value: Class> maps encoding names to encoders |
|
19 |
||
20 |
' |
|
21 |
! |
|
22 |
||
23 |
||
24 |
!Encoder class methodsFor:'instance creation'! |
|
25 |
||
26 |
for: anEncoding |
|
27 |
||
41 | 28 |
anEncoding isSymbol ifFalse: [ ^anEncoding streamingAsEncoder ]. |
29 |
^Encoders at: anEncoding ifAbsent: [ |
|
30 |
DialectEncoder |
|
31 |
ifNil: [ self error: 'Unknown encoding!!' ] |
|
32 |
ifNotNil: [ DialectEncoder for: anEncoding ] ] |
|
6 | 33 |
! |
34 |
||
35 |
streamingAsEncoder |
|
36 |
||
37 |
^self new |
|
38 |
! ! |
|
39 |
||
40 |
!Encoder class methodsFor:'accessing'! |
|
41 |
||
42 |
encoders |
|
43 |
||
44 |
^Encoders ifNil: [ Encoders := IdentityDictionary new ] |
|
45 |
! ! |
|
46 |
||
47 |
!Encoder methodsFor:'accessing'! |
|
48 |
||
49 |
backupState |
|
50 |
! |
|
51 |
||
52 |
decodeFrom: aReadStream |
|
53 |
||
54 |
^self subclassResponsibility |
|
55 |
! |
|
56 |
||
57 |
encode: aCharacter on: aWriteStream |
|
58 |
||
59 |
^self subclassResponsibility |
|
60 |
! |
|
61 |
||
62 |
restoreState |
|
63 |
! |
|
64 |
||
65 |
streamingAsEncoder |
|
66 |
||
67 |
^self |
|
68 |
! ! |
|
69 |
||
70 |
!Encoder class methodsFor:'documentation'! |
|
71 |
||
72 |
version_SVN |
|
73 |
^ '$Id$' |
|
74 |
! ! |