--- a/JavaClassReader.st Mon Dec 18 13:36:37 2000 +0000
+++ b/JavaClassReader.st Mon Dec 18 14:34:49 2000 +0000
@@ -12,6 +12,8 @@
+"{ Package: 'stx:libjava' }"
+
Object subclass:#JavaClassReader
instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots
constSlot'
@@ -1193,7 +1195,7 @@
] ifFalse:[
constReader := #(
"/ JAVA types
- readConstant_Asciz "/ 1 - now called Utf8
+ readConstant_Utf8 "/ 1 - now called Utf8
readConstant_Unicode "/ 2
readConstant_Integer "/ 3
readConstant_Float "/ 4
@@ -1579,6 +1581,34 @@
"Created: / 15.4.1996 / 15:20:33 / cg"
"Modified: / 7.5.1998 / 11:42:45 / cg"
+!
+
+readConstant_Unicode
+ |len string ascii|
+
+ len := inStream nextUnsignedShortMSB:msb.
+ string := TwoByteString new:len.
+ 1 to:len do:[:idx |
+ ascii := inStream nextUnsignedShortMSB:msb.
+ string at:idx put:(Character value:ascii).
+ ].
+
+ Verbose ifTrue:[Transcript show:'asciz; unicodeString= '; showCR:string].
+
+ ^ string
+!
+
+readConstant_Utf8
+ |len bytes string|
+
+ len := inStream nextUnsignedShortMSB:msb.
+ bytes := ByteArray new:len.
+ inStream nextBytes:len into:bytes startingAt:1.
+ string := CharacterArray fromUTF8Bytes:bytes.
+
+ Verbose ifTrue:[Transcript show:'asciz; string= '; showCR:string].
+
+ ^ string
! !
!JavaClassReader methodsFor:'file reading - constants-ST'!
@@ -2166,6 +2196,6 @@
!JavaClassReader class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.87 2000/02/14 18:53:01 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.88 2000/12/18 14:34:49 cg Exp $'
! !
JavaClassReader initialize!