Here you can find the source of getBytes(String str, String charset)
public static byte[] getBytes(String str, String charset)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; public class Main { /**// w w w .j a v a 2 s. c o m * @return the value of str.getBytes() without the idiotic checked exception */ public static byte[] getBytes(String str, String charset) { try { return str.getBytes(charset); } catch (UnsupportedEncodingException ex) { throw new IllegalArgumentException(charset, ex); } } }