Java Byte Array to String by Charset str(byte[] bytes, String charset)

Here you can find the source of str(byte[] bytes, String charset)

Description

str

License

Apache License

Declaration

public static String str(byte[] bytes, String charset) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.charset.Charset;

public class Main {

    public static String str(Object... objs) {
        StringBuilder sb = new StringBuilder();
        for (Object obj : objs) {
            sb.append(obj);/*from  w  ww  .  j  a v  a  2 s  .c  o  m*/
        }
        return sb.toString();
    }

    public static String str(byte[] bytes, String charset) {
        return new String(bytes, Charset.forName(charset));
    }
}

Related

  1. newString(byte[] bytes, String charsetName)
  2. newString(final byte[] bytes, final Charset charset)
  3. newString(final byte[] bytes, final Charset charset)
  4. newStringFromSplit(CharsetDecoder decoder, CharsetDecoder utf8Decoder, String encoding, byte[] fieldBytes, int length)
  5. parseBytes(byte[] encoded, Charset charset)
  6. stringToByteArray(String str, Charset charsetForEncoding, int lenOfByteArray, byte filler)
  7. toBytes(CharSequence str, String charsetName)
  8. toBytes(String string, Charset charset)
  9. toChars(byte[] b, String charset)