Thursday, January 3, 2013

ByteBuffer to String

Hi!

I have the following Java code

import com.google.common.base.Charsets;  import java.nio.ByteBuffer;    ByteBuffer msg = ... // a ByteBuffer that contains a String  String s = Charsets.UTF_8.decode(msg).toString();  

this works fine in Java, but when I try to compile it with GWT I get:

The method decode(ByteBuffer) is undefined for the type Charset

What's the proper way, in GWT, to obtain a String (encoded in UTF-8) that's inside a ByteBuffer?

Thanks!

ps: this question has also been asked in StackOverflow, if anyone wants to answer there and gain some rep

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/bQXurtXIHcUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment