class QuotedStringTokenizer extends StringTokenizer {

    public static String quoteIfNeeded(String s, String delim) {
        if (s == null)
            return null;
        if (s.length() == 0)
            return "\"\"";

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == '\\' || c == '"' || c == '\'' || Character.isWhitespace(c) || delim.indexOf(c) >= 0) {
                StringBuilder b = new StringBuilder(s.length() + 8);
                quote(b, s);
                return b.toString();
            }
        }

        return s;
    }

    public  QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters, boolean returnQuotes);
    public  QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters);
    public  QuotedStringTokenizer(String str, String delimiter);
    public  QuotedStringTokenizer(String str);

}