How to use the icu4j Charset implementations and CharsetDecoderICU?

224 views Asked by At

So, I know how to get your average Charset sure, with StandardCharsets.UTF_8 or maybe even Charset.forName("UTF-32LE") for a non-standard, but which implementation am I getting? I would like to use these decoders, use this CharsetDecoderICU with it's nifty-looking Callback setup (I have yet to find any examples of this usage), but I just can't figure out how to get access to it.

I have tried to explicitly invoke the icu4j CharsetUTF32LE for instance, but it appears to be, is it package privileged? While the source is clearly there and I can look at it, I can't seem to import it directly in my code, despite it being in the build path with the public classes. Is there some kind of provider that needs to be registered, like with encryption providers?

Please, though the project is very active and some of the docs are good, I just don't get where the entry point is, or what's going on here with package visbility! Thanks.

1

There are 1 answers

0
Joshua On

Okay, I feel a bit dumb for it taking so long, but I found the answer.

CharsetICU.forNameICU("UTF-8);

does the trick! :)