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

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

Description

get String

License

Apache License

Declaration

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

Method Source Code

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

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

public class Main {

    public static String getString(byte[] bytes, String charset) {
        try {//from   ww w.j av a2s . com
            return new String(bytes, charset);
        } catch (UnsupportedEncodingException e) {
            throw new IllegalArgumentException(e);
        }
    }

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

Related

  1. getMaxBytes(String string, int maxBytes, Charset charSet)
  2. getNumberOfBytesPerCharacter(final String charsetName)
  3. getPrefixWithMaxBytes(String string, int maxBytes, Charset charSet)
  4. getRowId(final byte[] rowId, final Charset charset, final boolean base64encodeValues)
  5. getString(@Nonnull byte[] b, @Nonnegative int bufferSize, @Nonnegative int offset, @Nonnull Charset charset)
  6. getString(byte[] bytesIn, Charset cs)
  7. identify(byte[] bytes, CharsetDecoder decoder)
  8. inflate(byte[] bytes, Charset encoding)
  9. isCharset(byte[] b, String inCharset)