Little question about the output generated from the javap
command regarding the constant pool.
When javap
prints the pool it defines string constants as Asciz
strings, which I understand means null
terminated Ascii:
const #20 = Asciz hello world;
This would imply that the length of the string is not known, and to parse you would read each byte until you encounter the null
.
However, the length of constant pool string constants is defined by the two bytes preceding the string and there is no null
appended. (Constant pool specification).
Does javap
define strings as Asciz
incorrectly or does Asciz
have another meaning I'm not aware of?
See bug #6868539. It's fixed in OpenJDK7, now javap
prints Utf8
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With