ByteArray.st
changeset 13219 97fd6ec6dd46
parent 13078 7934a86b395b
child 13703 b1778b468963
equal deleted inserted replaced
13218:82cf34a45806 13219:97fd6ec6dd46
   160 %}.
   160 %}.
   161     ^ self basicNew:anInteger
   161     ^ self basicNew:anInteger
   162 ! !
   162 ! !
   163 
   163 
   164 
   164 
       
   165 
   165 !ByteArray class methodsFor:'queries'!
   166 !ByteArray class methodsFor:'queries'!
   166 
   167 
   167 isBuiltInClass
   168 isBuiltInClass
   168     "return true if this class is known by the run-time-system.
   169     "return true if this class is known by the run-time-system.
   169      Here, true is returned for myself, false for subclasses."
   170      Here, true is returned for myself, false for subclasses."
   170 
   171 
   171     ^ self == ByteArray
   172     ^ self == ByteArray
   172 
   173 
   173     "Modified: 23.4.1996 / 15:56:25 / cg"
   174     "Modified: 23.4.1996 / 15:56:25 / cg"
   174 ! !
   175 ! !
       
   176 
       
   177 
   175 
   178 
   176 !ByteArray methodsFor:'Compatibility-Squeak'!
   179 !ByteArray methodsFor:'Compatibility-Squeak'!
   177 
   180 
   178 bitXor:aByteArray
   181 bitXor:aByteArray
   179     "return a new byteArray containing the bitWise-xor of the receiver's and the
   182     "return a new byteArray containing the bitWise-xor of the receiver's and the
  2699     "Modified: / 12.9.1997 / 22:11:33 / cg"
  2702     "Modified: / 12.9.1997 / 22:11:33 / cg"
  2700     "Modified: / 17.3.1999 / 17:01:31 / stefan"
  2703     "Modified: / 17.3.1999 / 17:01:31 / stefan"
  2701     "Created: / 31.10.2001 / 09:43:41 / cg"
  2704     "Created: / 31.10.2001 / 09:43:41 / cg"
  2702 !
  2705 !
  2703 
  2706 
  2704 storeArrayElementOn:aStream
       
  2705     "Store as element of an array. Omit the leading '#'"
       
  2706 
       
  2707     |cls|
       
  2708 
       
  2709     ((cls := self class) == ByteArray or:[cls == ImmutableByteArray]) ifTrue:[
       
  2710 	"/ care for subclasses
       
  2711 	aStream nextPut:$[.
       
  2712 	self
       
  2713 	    do:[:byte | byte storeOn:aStream]
       
  2714 	    separatedBy:[aStream space].
       
  2715 	aStream nextPut:$].
       
  2716 	^ self
       
  2717     ].
       
  2718     super storeArrayElementOn:aStream
       
  2719 
       
  2720     "
       
  2721      #[1 2 3 4 5] storeOn:Transcript
       
  2722      #[1 2 3 4 5] storeArrayElementOn:Transcript
       
  2723 
       
  2724      #[1 2 3 4 5] storeString
       
  2725      #[1 2 3 4 5] displayString
       
  2726      #[1 2 3 4 5] printString
       
  2727     "
       
  2728 
       
  2729     "Modified: 12.9.1997 / 22:11:33 / cg"
       
  2730 !
       
  2731 
       
  2732 storeOn:aStream
  2707 storeOn:aStream
  2733     "append a printed representation from which the receiver can be
  2708     "append a printed representation from which the receiver can be
  2734      reconstructed to aStream. (reimplemented to make it look better)"
  2709      reconstructed to aStream. (reimplemented to make it look better)"
  2735 
  2710 
  2736     |cls|
  2711     |cls|
  2928     "
  2903     "
  2929      #[1 2 3 1 2 3 1 2 3 1 2 3 4 5 6 4 5 6] usedValues
  2904      #[1 2 3 1 2 3 1 2 3 1 2 3 4 5 6 4 5 6] usedValues
  2930     "
  2905     "
  2931 ! !
  2906 ! !
  2932 
  2907 
       
  2908 
  2933 !ByteArray methodsFor:'searching'!
  2909 !ByteArray methodsFor:'searching'!
  2934 
  2910 
  2935 indexOf:aByte startingAt:start
  2911 indexOf:aByte startingAt:start
  2936     "return the index of the first occurrence of the argument, aByte
  2912     "return the index of the first occurrence of the argument, aByte
  2937      in the receiver starting at start, anInteger; return 0 if not found.
  2913      in the receiver starting at start, anInteger; return 0 if not found.
  2983     "
  2959     "
  2984      #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0
  2960      #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0
  2985     "
  2961     "
  2986 ! !
  2962 ! !
  2987 
  2963 
       
  2964 
  2988 !ByteArray methodsFor:'testing'!
  2965 !ByteArray methodsFor:'testing'!
  2989 
  2966 
  2990 isByteArray
  2967 isByteArray
  2991     "return true, if the receiver is some kind of bytearray;
  2968     "return true, if the receiver is some kind of bytearray;
  2992      true is returned here - the method is redefined from Object."
  2969      true is returned here - the method is redefined from Object."
  3010 ! !
  2987 ! !
  3011 
  2988 
  3012 !ByteArray class methodsFor:'documentation'!
  2989 !ByteArray class methodsFor:'documentation'!
  3013 
  2990 
  3014 version
  2991 version
  3015     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.203 2010-09-21 06:58:04 stefan Exp $'
  2992     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.204 2011-01-18 17:09:02 cg Exp $'
  3016 !
  2993 !
  3017 
  2994 
  3018 version_CVS
  2995 version_CVS
  3019     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.203 2010-09-21 06:58:04 stefan Exp $'
  2996     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.204 2011-01-18 17:09:02 cg Exp $'
  3020 ! !
  2997 ! !