Here you can find the source of decode(final byte[] binaryValue, final Charset charset)
public static String decode(final byte[] binaryValue, final Charset charset)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from ww w. ja v a2 s .c o m*/ * IBM Corporation - initial API and implementation *******************************************************************************/ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; public class Main { public static String decode(final byte[] binaryValue, final Charset charset) { final CharsetDecoder decoder = charset.newDecoder(); try { final ByteBuffer bbuf = ByteBuffer.wrap(binaryValue); final CharBuffer cbuf = decoder.decode(bbuf); return cbuf.toString(); } catch (final CharacterCodingException e) { return null; } } }