Programmer Reference : UnicodeSupport : Utf16LittleEndianView
Utf16LittleEndianView
Description
A <Utf16LittleEndianView> provides a bidirectional view over the unicode component as a collection of UTF-16 code units in little-endian format.
  • #next/#previous - Answers an 16-bit <Integer>.
  • #contents - Answers a <Utf16LE>
Examples
| view leA leB leC |
view := Utf16LittleEndianView on: 'abc'.
self assert: [view next = (leA := (OSUInt16 new at: 0 put: $a value; yourself) leUint16At: 0)].
self assert: [view next = (leB := (OSUInt16 new at: 0 put: $b value; yourself) leUint16At: 0)].
self assert: [view next = (leC := (OSUInt16 new at: 0 put: $c value; yourself) leUint16At: 0)].
self assert: [view atEnd].
self assert: [view previous = (leC := (OSUInt16 new at: 0 put: $c value; yourself) leUint16At: 0)].
self assert: [view previous = (leB := (OSUInt16 new at: 0 put: $b value; yourself) leUint16At: 0)].
self assert: [view previous = (leA := (OSUInt16 new at: 0 put: $a value; yourself) leUint16At: 0)].
self assert: [view atStart].
self assert: [view contents asArray = { leA. leB. leC. }]
Class Methods
None
Instance Methods
None
Last modified date: 01/18/2023