ExternalBytes.st
branchjv
changeset 20143 c64b16f62536
parent 19863 513bd7237fe7
parent 20138 cd6fdc7534e4
child 20205 03e626304d06
--- a/ExternalBytes.st	Tue Jul 12 06:40:09 2016 +0200
+++ b/ExternalBytes.st	Wed Jul 13 07:01:16 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -748,7 +746,6 @@
     "
 ! !
 
-
 !ExternalBytes methodsFor:'accessing'!
 
 address
@@ -913,6 +910,22 @@
 asExternalBytes
 
     ^ self
+!
+
+asString
+    "speed up string conversions"
+
+    |size|
+
+    self class == ExternalBytes ifTrue:[
+        size := self size.
+        ^ (String uninitializedNew:size) replaceBytesFrom:1 to:size with:self startingAt:1.
+    ].
+    ^ super asString.
+
+    "
+      #[16r41 16r42 16r43] asExternalBytes asString
+    "
 ! !
 
 !ExternalBytes methodsFor:'filling & replacing'!