CharacterEncoderImplementations__ISO10646_to_UTF16LE.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 18 Jul 2011 16:22:09 +0100
branchjv
changeset 17846 24edc476ac18
parent 17845 7e0cfaac936d
child 17883 209190914636
permissions -rw-r--r--
Merged with /trunk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8903
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2005 by eXept Software AG
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libbasic' }"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
"{ NameSpace: CharacterEncoderImplementations }"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
ISO10646_to_UTF16BE subclass:#ISO10646_to_UTF16LE
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	instanceVariableNames:''
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Collections-Text-Encodings'
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!ISO10646_to_UTF16LE class methodsFor:'documentation'!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 COPYRIGHT (c) 2005 by eXept Software AG
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
              All Rights Reserved
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    encodes/decodes UTF16 LittleEndian (little-end-first)
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
9326
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    44
!
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    45
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    46
examples
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    47
"
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    48
  Encoding (unicode to utf16LE)
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    49
     ISO10646_to_UTF16LE encodeString:'hello'.
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    50
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    51
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    52
  Decoding (utf16LE to unicode):
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    53
     |t|
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    54
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    55
     t := ISO10646_to_UTF16LE encodeString:''.
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    56
     ISO10646_to_UTF16LE decodeString:t.
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    57
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    58
  Decoding (utf16LE-Bytes to unicode):
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    59
     |bytes|
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    60
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    61
     bytes := #[ 16r40 0 16r41 0 16r42 0 16r43 0 16r44 0 ].
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    62
     ISO10646_to_UTF16LE decodeString:bytes.
46b7df422c6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8903
diff changeset
    63
"
8903
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
! !
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
!ISO10646_to_UTF16LE methodsFor:'private'!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
nextPutTwoByteValue:anInteger to:aStream
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    aStream nextPutShort:anInteger MSB:false
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
nextTwoByteValueFrom:aStream
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    ^ aStream nextUnsignedShortMSB:false
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
! !
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
!ISO10646_to_UTF16LE methodsFor:'queries'!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
nameOfEncoding
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    ^ #'utf8le'
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
! !
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
!ISO10646_to_UTF16LE class methodsFor:'documentation'!
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
4e15c297fadc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
version
17846
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
    85
    ^ '$Id: CharacterEncoderImplementations__ISO10646_to_UTF16LE.st 10660 2011-07-18 15:22:09Z vranyj1 $'
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
    86
! !