[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructing java.lang.String in constant pool
From: |
Brian Jones |
Subject: |
Re: Constructing java.lang.String in constant pool |
Date: |
28 Jun 2001 08:09:31 -0400 |
User-agent: |
Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 |
Patrick Doyle <address@hidden> writes:
> What is the best way for a JVM to instantiate a String for a constant pool
> entry of type "CONSTANT_String"? I'm looking for the most straightforward
> approach that won't cause me a lot of grief down the road. There are a
> number of constructors for String; should I use one of those, or just use
> my inside knowledge of the String class to construct an instance manually?
>
> The closest thing to sanity I can think of is to convert the UTF8-encoded
> characters into a char array and then use the String(char[], length)
> constructor. AFAIK I would have to implement the conversion myself.
>
> Does this seem like the right approach?
I don't know if this matters, but your approach seems to ignore locale
encoding.
Brian
--
Brian Jones <address@hidden>