Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

creating internalized String directly from byte[] array?

807589Nov 28 2008 — edited Dec 3 2008
Currently I create many internalized Strings from a byte array using
new String(byte[], from, length).intern();
This takes many 100 nanoseconds per String since
a string object is created each time involving 8bit to 16bit character conversion.

Does Java provide a more efficient method avoiding String object creation if possible?
Otherwise I would need to maintain my own String pool.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2008
Added on Nov 28 2008
28 comments
578 views