Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9075571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:53:21+00:00 2026-06-16T18:53:21+00:00

On a PlayN project I have the following Java code import com.google.common.base.Charsets; import java.nio.ByteBuffer;

  • 0

On a PlayN project 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:53:22+00:00Added an answer on June 16, 2026 at 6:53 pm

    You should be able to use new String(bytes, "UTF-8") after getting the bytes out of the ByteBuffer as a byte[] using ByteBuffer#get(byte[]).
    This String constructor, along with getBytes(String), is implemented for UTF-8 and ISO-8859-1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following task for my project: I need to validate a java object,
Imagine you have a PlayN game which uses Guice bindings in its core project:
I'm using Play! framework 20 on a java project and I have a problem
We have the following configuration in a project... configurations { //compile.exclude module: 'commons' //all*.exclude
am using play 2 framework with java I have added a project dependency as
I have a WPF project with a border using the following style. The plan
I have an OpenGL project in Java that draws a series of circles on
I have the following code in a tester class in my main assembly, PocoGenerator
So I have the following dependencies section in gradle dependencies { compile project(':sdi-master') compile
I have the following setup within my project... A multi project gradle build for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.