Accessing byte arrays...

Andrew C. Greenberg werdna at gate.net
Mon Apr 12 05:59:28 UTC 1999


>Hi, I need to be able to make, modify and create byte arrays.  How 
>do I go about
>doing this?  I hope this does not involve creating a whole bunch of pluggable
>primitives.

Just as with Array, IntegerArray. String and the host of other 
indexable classes, you create with:

	array := ByteArray new: sizeOfArray,

then, to access a slot:

	array at: index.

or, to assign to a slot:

	array at: index put: value.

Remember that Smalltalk array indexing begins at 1.  Hope that's 
concrete enough for your purposes.  There are a host of other 
operations on such arrays and their slices, which you can find from 
reading the classes.





More information about the Squeak-dev mailing list