code: private static String decodeString(ByteBuffer src) throws CharacterCodingException
      {
          // the decoder needs to be reset every time we use it, hence the copy per thread
          CharsetDecoder theDecoder = decoder.get();
          theDecoder.reset();
  
          final CharBuffer dst = CharBuffer.allocate(
                  (int) ((double) src.remaining() * theDecoder.maxCharsPerByte()));
  
          CoderResult cr = theDecoder.decode(src, dst, true);
          if (!cr.isUnderflow())
              cr.throwException();
  
          cr = theDecoder.flush(dst);
          if (!cr.isUnderflow())
              cr.throwException();
  
          return dst.flip().toString();
      }
docs: is resolved in a release used by Cassandra.