initialization done lazily (to speed up startup)
authorClaus Gittinger <cg@exept.de>
Thu, 07 May 2015 22:36:31 +0200
changeset 3547 399b59b67fda
parent 3546 85cad7a4c32b
child 3548 5424405a96ed
initialization done lazily (to speed up startup)
Base64Coder.st
--- a/Base64Coder.st	Thu May 07 22:36:29 2015 +0200
+++ b/Base64Coder.st	Thu May 07 22:36:31 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
               All Rights Reserved
@@ -134,18 +136,20 @@
 
 !Base64Coder class methodsFor:'initialization'!
 
-initialize
+initializeMappings
     "initialize class variables"
 
-    "65 characters representing the 6-bit values from 0-63 and one pad character"
-    Base64Mapping := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.
-    Base64ReverseMapping := ByteArray new:128 withAll:255.
-    Base64Mapping keysAndValuesDo:[:idx :char|
-        Base64ReverseMapping at:char codePoint put:idx-1.
+    Base64Mapping isNil ifTrue:[
+        "65 characters representing the 6-bit values from 0-63 and one pad character"
+        Base64Mapping := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.
+        Base64ReverseMapping := ByteArray new:128 withAll:255.
+        Base64Mapping keysAndValuesDo:[:idx :char|
+            Base64ReverseMapping at:char codePoint put:idx-1.
+        ].
     ].
 
     "
-     self initialize
+     self initializeMappings
     "
 ! !
 
@@ -272,12 +276,10 @@
 !Base64Coder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.25 2015-02-03 14:33:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.26 2015-05-07 20:36:31 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.25 2015-02-03 14:33:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.26 2015-05-07 20:36:31 cg Exp $'
 ! !
 
-
-Base64Coder initialize!