if (decoded != null) {
ByteBuffer bb = ByteBuffer.wrap(decoded);
CharBuffer cb = CharBuffer.allocate(bb.capacity());
CharsetDecoder decoder = charset.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPORT);
decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
try {
boolean bDecodeLoop = true;
while (bDecodeLoop) {
CoderResult result = decoder.decode(bb, cb, true);
sb.append(cb.array(), cb.arrayOffset(), cb.position());