ByteArray.st
changeset 18611 fca966d5e383
parent 18596 d6abf6a67de4
child 18617 fbfd2d411738
child 18655 57469de23fac
--- a/ByteArray.st	Mon Jul 20 13:36:44 2015 +0200
+++ b/ByteArray.st	Tue Jul 21 10:20:02 2015 +0200
@@ -1157,23 +1157,6 @@
     "Modified: 12.11.1996 / 15:45:02 / cg"
 !
 
-asString
-    "speed up string conversions"
-
-    |cls size|
-
-    cls := self class.
-    (cls == ByteArray or:[cls == ImmutableByteArray]) ifTrue:[
-        size := self size.
-        ^ (String uninitializedNew:size) replaceBytesFrom:1 to:size with:self startingAt:1.
-    ].
-    ^ super asString
-
-    "
-      #[16r41 16r42 16r43] asString
-    "
-!
-
 beImmutable
     "make myself write-protected"
 
@@ -1203,51 +1186,6 @@
     "
      #[1 2 3] literalArrayEncoding
     "
-!
-
-utf8Decoded
-    "Interpreting myself as an UTF-8 representation, decode and return the decoded string."
-
-    |cls in out|
-
-    cls := self class.
-    (cls == ByteArray or:[cls == ImmutableByteArray]) ifTrue:[
-        self containsNon7BitAscii ifFalse:[
-            "speed up common case"
-            ^ self asSingleByteString.
-        ].
-        out := CharacterWriteStream on:(String uninitializedNew:self size).
-        in := self readStream.
-        [in atEnd] whileFalse:[
-            out nextPut:(Character utf8DecodeFrom:in).
-        ].
-        ^ out contents
-    ].
-    ^ super utf8Decoded
-
-    "
-     #[16r41 16r42] utf8Decoded
-     #[16rC8 16rA0] utf8Decoded
-     (Character value:16r220) utf8Encoded
-     (Character value:16r220) utf8Encoded utf8Decoded
-
-     (Character value:16r800) utf8Encoded
-     (Character value:16r220) utf8Encoded utf8Decoded
-    "
-
-    "test:
-
-      |utf8Encoding original readBack|
-
-      1 to:16rFFFF do:[:ascii |
-        original := (Character value:ascii) asString.
-        utf8Encoding := original utf8Encoded.
-        readBack := utf8Encoding utf8Decoded.
-        readBack = original ifFalse:[
-            self halt
-        ]
-      ]
-    "
 ! !
 
 !ByteArray methodsFor:'copying'!
@@ -2863,7 +2801,7 @@
     REGISTER unsigned char *cp;
     REGISTER unsigned char *endP;
 
-    if (__isByteArray(self)) {
+    if (__isByteArrayLike(self)) {
         cp = &(__ByteArrayInstPtr(self)->ba_element[0]);
         endP = cp + __byteArraySize(self);
 #if __POINTER_SIZE__ == 8
@@ -2928,13 +2866,6 @@
     "
 !
 
-referencesAny:aCollection
-    "redefined to speed up searching when many byteArray instances are present"
-
-    self class == ByteArray ifTrue:[^ false].
-    ^ super referencesAny:aCollection
-!
-
 usageCounts
     "return an array filled with value-counts -
      This is needed in the bitmap/image classes to get info on color usage.