Back: Boolean-storing Up: Base classes Forward: ByteArray class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.13 ByteArray

Defined in namespace Smalltalk
Superclass: ArrayedCollection
Category: Collections-Sequenceable
My instances are similar to strings in that they are both represented as a sequence of bytes, but my individual elements are integers, where as a String's elements are characters.

1.13.1 ByteArray class: instance creation  (class)
1.13.2 ByteArray: basic  (instance)
1.13.3 ByteArray: built ins  (instance)
1.13.4 ByteArray: CObject  (instance)
1.13.5 ByteArray: converting  (instance)
1.13.6 ByteArray: more advanced accessing  (instance)
1.13.7 ByteArray: storing  (instance)


1.13.1 ByteArray class: instance creation

fromCData: aCObject size: anInteger
Answer a ByteArray containing anInteger bytes starting at the location pointed to by aCObject


1.13.2 ByteArray: basic

= aCollection
Answer whether the receiver's items match those in aCollection

indexOf: anElement startingAt: anIndex
Answer the first index > anIndex which contains anElement. Invoke exceptionBlock and answer its result if no item is found

indexOf: anElement startingAt: anIndex ifAbsent: exceptionBlock
Answer the first index > anIndex which contains anElement. Invoke exceptionBlock and answer its result if no item is found


1.13.3 ByteArray: built ins

asCData: aCType
Allocate memory with malloc for a copy of the receiver, and return it converted to a CObject with the given type

at: anIndex ifAbsent: aBlock
Answer the index-th indexed instance variable of the receiver

byteAt: index
Answer the index-th indexed instance variable of the receiver

byteAt: index put: value
Store the `value' byte in the index-th indexed instance variable of the receiver

hash
Answer an hash value for the receiver

replaceFrom: start to: stop with: aByteArray startingAt: replaceStart
Replace the characters from start to stop with the bytes contained in aByteArray (which, actually, can be any variable byte class), starting at the replaceStart location of aByteArray

replaceFrom: start to: stop withString: aString startingAt: replaceStart
Replace the characters from start to stop with the ASCII codes contained in aString (which, actually, can be any variable byte class), starting at the replaceStart location of aString


1.13.4 ByteArray: CObject

asCData
Allocate memory with malloc for a copy of the receiver, and return a pointer to it as a CByte.

castTo: type
Give access to the receiver as a value with the given CType.


1.13.5 ByteArray: converting

asString
Answer a String whose character's ASCII codes are the receiver's contents

asUnicodeString
Answer a UnicodeString whose character's codes are the receiver's contents. This is not implemented unless you load the I18N package.


1.13.6 ByteArray: more advanced accessing

charAt: index
Access the C char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access.

charAt: index put: value
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access.

doubleAt: index
Access the C double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

doubleAt: index put: value
Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C double. Indices are 1-based just like for other Smalltalk access.

floatAt: index
Access the C float at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

floatAt: index put: value
Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C float. Indices are 1-based just like for other Smalltalk access.

intAt: index
Access the C int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

intAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access.

longAt: index
Access the C long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

longAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access.

longDoubleAt: index
Access the C long double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

longDoubleAt: index put: value
Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C double. Indices are 1-based just like for other Smalltalk access.

objectAt: index
Access the Smalltalk object (OOP) at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

objectAt: index put: value
Store a pointer (OOP) to the Smalltalk object identified by `value', at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

shortAt: index
Access the C short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

shortAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access.

stringAt: index
Access the string pointed by the C `char *' at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

stringAt: index put: value
Store the Smalltalk String object identified by `value', at the given index in the receiver, writing it like a *FRESHLY ALLOCATED* C string. It is the caller's responsibility to free it if necessary. Indices are 1-based just like for other Smalltalk access.

ucharAt: index
Access the C unsigned char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access.

ucharAt: index put: value
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access.

uintAt: index
Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

uintAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access.

ulongAt: index
Access the C unsigned long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

ulongAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access.

unsignedCharAt: index
Access the C unsigned char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access.

unsignedCharAt: index put: value
Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access.

unsignedIntAt: index
Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

unsignedIntAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access.

unsignedLongAt: index
Access the C unsigned long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

unsignedLongAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access.

unsignedShortAt: index
Access the C unsigned short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

unsignedShortAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access.

ushortAt: index
Access the C unsigned short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access.

ushortAt: index put: value
Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access.


1.13.7 ByteArray: storing

isLiteralObject
Answer whether the receiver is expressible as a Smalltalk literal.

storeLiteralOn: aStream
Put a Smalltalk literal evaluating to the receiver on aStream.

storeOn: aStream
Put Smalltalk code evaluating to the receiver on aStream.



Back: ByteArray-more advanced accessing Up: ByteArray Forward: CAggregate   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html