ByteArray.st
changeset 5019 4cd8b02e26e1
parent 4983 07e6aab900d9
child 5024 abff1ede34d1
equal deleted inserted replaced
5018:2edc19eb812d 5019:4cd8b02e26e1
  2608 
  2608 
  2609     "Created: 25.10.1995 / 13:33:26 / cg"
  2609     "Created: 25.10.1995 / 13:33:26 / cg"
  2610     "Modified: 22.4.1996 / 12:54:06 / cg"
  2610     "Modified: 22.4.1996 / 12:54:06 / cg"
  2611 !
  2611 !
  2612 
  2612 
       
  2613 printOn:aStream
       
  2614     "append a printed representation to aStream"
       
  2615 
       
  2616     self class == ByteArray ifTrue:[    "/ care for subclasses
       
  2617         aStream nextPutAll:'#['.
       
  2618         self 
       
  2619             do:[:byte | byte printOn:aStream]
       
  2620             separatedBy:[aStream space].
       
  2621         aStream nextPut:$].
       
  2622         ^ self
       
  2623     ].
       
  2624     ^ super printOn:aStream
       
  2625 
       
  2626     "
       
  2627      #[1 2 3 4 5] printOn:Transcript
       
  2628 
       
  2629 
       
  2630      #[1 2 3 4 5] storeString            
       
  2631      #[1 2 3 4 5] displayString        
       
  2632      #[1 2 3 4 5] printString         
       
  2633     "
       
  2634 
       
  2635     "Modified: / 12.9.1997 / 22:11:33 / cg"
       
  2636     "Modified: / 17.3.1999 / 17:01:31 / stefan"
       
  2637 !
       
  2638 
  2613 printOn:aStream base:radix
  2639 printOn:aStream base:radix
  2614     "append a printed representation to aStream in the given number base."
  2640     "append a printed representation to aStream in the given number base."
  2615 
  2641 
  2616     self class == ByteArray ifTrue:[    "/ care for subclasses
  2642     self class == ByteArray ifTrue:[    "/ care for subclasses
  2617 	aStream nextPutAll:'#['.
  2643         aStream nextPutAll:'#['.
  2618 	self 
  2644         self 
  2619 	    do:[:byte | byte printOn:aStream base:radix]
  2645             do:[:byte | byte printOn:aStream base:radix]
  2620 	    separatedBy:[aStream space].
  2646             separatedBy:[aStream space].
  2621 	aStream nextPut:$].
  2647         aStream nextPut:$].
  2622 	^ self
  2648         ^ self
  2623     ].
  2649     ].
  2624     ^ super printOn:aStream
  2650     ^ self printOn:aStream
  2625 
  2651 
  2626     "
  2652     "
  2627      #[1 2 3 4 5] printOn:Transcript base:2  
  2653      #[1 2 3 4 5] printOn:Transcript base:2
       
  2654      'Hello World' printOn:Transcript base:2
  2628 
  2655 
  2629      #[1 2 3 4 5] storeString            
  2656      #[1 2 3 4 5] storeString            
  2630      #[1 2 3 4 5] displayString        
  2657      #[1 2 3 4 5] displayString        
  2631      #[1 2 3 4 5] printString         
  2658      #[1 2 3 4 5] printString         
  2632     "
  2659     "
  2762     "
  2789     "
  2763      #[1 2 3 1 2 3 1 2 19] max 
  2790      #[1 2 3 1 2 3 1 2 19] max 
  2764     "
  2791     "
  2765 ! !
  2792 ! !
  2766 
  2793 
       
  2794 
  2767 !ByteArray methodsFor:'special queries'!
  2795 !ByteArray methodsFor:'special queries'!
  2768 
  2796 
  2769 usageCounts
  2797 usageCounts
  2770     "return an array filled with value-counts -
  2798     "return an array filled with value-counts -
  2771      This is needed in the bitmap/image classes to get info on color usage.
  2799      This is needed in the bitmap/image classes to get info on color usage.
  2894 ! !
  2922 ! !
  2895 
  2923 
  2896 !ByteArray class methodsFor:'documentation'!
  2924 !ByteArray class methodsFor:'documentation'!
  2897 
  2925 
  2898 version
  2926 version
  2899     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.134 1999-11-12 23:22:32 stefan Exp $'
  2927     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.135 1999-11-25 20:11:30 stefan Exp $'
  2900 ! !
  2928 ! !