Here you can find the source of fromUTF8(byte[] bytes)
Parameter | Description |
---|---|
bytes | UTF-8 bytes. |
public static String fromUTF8(byte[] bytes)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static final String UTF_8_ENCODING = "UTF-8"; /**//from ww w. ja v a 2 s. c om * Convert from UTF-8 bytes to a String. * * @param bytes UTF-8 bytes. * @return a String. */ public static String fromUTF8(byte[] bytes) { if (bytes == null) { return null; } try { return new String(bytes, UTF_8_ENCODING); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8 not supported?", e); } } }