Java Byte Array Decode decode(String encoding, byte[] bytes)

Here you can find the source of decode(String encoding, byte[] bytes)

Description

decode

License

Apache License

Declaration

public static String decode(String encoding, byte[] bytes) throws UnsupportedEncodingException 

Method Source Code


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

import java.io.UnsupportedEncodingException;

public class Main {
    public static String decode(String encoding, byte[] bytes) throws UnsupportedEncodingException {
        if (encoding == null) {
            return new String(bytes, "UTF-8");
        } else {/*from w w  w  .  j  a  v  a  2  s  .c  o  m*/
            return new String(bytes, encoding);
        }
    }
}

Related

  1. decode(byte[] source)
  2. decode(byte[] source, int off, int len)
  3. decode(byte[] src, String charset)
  4. decode(Byte[] wrap)
  5. decode(final byte[] source, final int off, final int len)
  6. decode(String encoding, byte[] data)
  7. decodeBytes(byte[] data, String encoding)
  8. decodeObject(byte[] bytes)
  9. decodeObject(final byte[] bytes)