Here you can find the source of getBytes(String s, String encoding)
public static byte[] getBytes(String s, String encoding)
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.UnsupportedEncodingException; public class Main { public static byte[] getBytes(String s, String encoding) { byte[] bytes = null; if (s != null) { try { bytes = s.getBytes(encoding); } catch (UnsupportedEncodingException e) { bytes = s.getBytes();//from w w w . jav a 2 s . co m } } return bytes; } }