public String encode(String string) throws IllegalArgumentException
{
ParameterValidation.throwIllegalArgExceptionIfNull(string, "String");
Writer sw = new StringWriter();
CharWriter charWriter = new WriterCharWriter(sw);
safeEncode(string.toCharArray(), 0, string.length(), charWriter);
return sw.toString();
}