Here you can find the source of decode(String encoding, byte[] data)
Parameter | Description |
---|---|
encoding | a parameter |
text | a parameter |
public static String decode(String encoding, byte[] data)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { /**//ww w .j av a 2 s . co m * Decodes a byte array from specified encoding to a unicode String. This * method returns null if the encoding is not supported * * @param encoding * @param text * @return byte[] */ public static String decode(String encoding, byte[] data) { if (data != null) { if (encoding == null) return new String(data); try { return new String(data, encoding); } catch (UnsupportedEncodingException e) { } } return null; } }