Base32Coder.st
changeset 3546 85cad7a4c32b
parent 2326 497afb98bdcf
child 3762 446521a66e42
--- a/Base32Coder.st	Wed May 06 18:20:36 2015 +0200
+++ b/Base32Coder.st	Thu May 07 22:36:29 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
               All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libbasic2' }"
 
+"{ NameSpace: Smalltalk }"
+
 BaseNCoder subclass:#Base32Coder
 	instanceVariableNames:''
 	classVariableNames:'Base32Mapping Base32ReverseMapping'
@@ -122,18 +126,20 @@
 
 !Base32Coder class methodsFor:'initialization'!
 
-initialize
+initializeMappings
     "initialize class variables"
-
-    "33 characters representing the 5-bit values from 0-31 and one pad character"
-    Base32Mapping := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='.
-    Base32ReverseMapping := ByteArray new:96 withAll:255.
-    Base32Mapping keysAndValuesDo:[:idx :char|
-        Base32ReverseMapping at:char codePoint put:idx-1.
+    
+    Base32Mapping isNil ifTrue:[
+        "33 characters representing the 5-bit values from 0-31 and one pad character"
+        Base32Mapping := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='.
+        Base32ReverseMapping := ByteArray new:96 withAll:255.
+        Base32Mapping keysAndValuesDo:[:idx :char|
+            Base32ReverseMapping at:char codePoint put:idx-1.
+        ].
     ].
 
     "
-     self initialize
+     self initializeMappings
     "
 ! !
 
@@ -243,11 +249,10 @@
 !Base32Coder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Base32Coder.st,v 1.3 2009-11-03 08:59:04 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Base32Coder.st,v 1.4 2015-05-07 20:36:29 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Base32Coder.st,v 1.3 2009-11-03 08:59:04 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Base32Coder.st,v 1.4 2015-05-07 20:36:29 cg Exp $'
 ! !
 
-Base32Coder initialize!