Here you can find the source of toByteArray(String content, String charsetName)
public static byte[] toByteArray(String content, String charsetName)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] toByteArray(String content, String charsetName) { byte[] bytes; try {/* w w w. j a va 2 s .c o m*/ bytes = content.getBytes(charsetName); } catch (Exception ex) { // CoreException, UnsupportedEncodingException bytes = content.getBytes(); } return bytes; } }