Java String to Byte Array getBytes(String string, String charsetName)

Here you can find the source of getBytes(String string, String charsetName)

Description

get Bytes

License

Open Source License

Declaration

private final static byte[] getBytes(String string, String charsetName) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.UnsupportedEncodingException;

public class Main {
    private final static byte[] getBytes(String string, String charsetName) {
        try {//from   www .ja  v  a 2  s  . c o m
            return string.getBytes(charsetName);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. getBytes(String str)
  2. getBytes(String str)
  3. getBytes(String str)
  4. getBytes(String str)
  5. getBytes(String str, String charset)
  6. getBytes(String string, String encoding)