QuotedStringTokenizer extends StringTokenizer { @Override public String nextToken() throws NoSuchElementException { if (!hasMoreTokens() || token == null) throw new NoSuchElementException(); String t = token.toString(); token.setLength(0); hasToken = false; return t; } QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters, boolean returnQuotes);  QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters);  QuotedStringTokenizer(String str, String delimiter);  QuotedStringTokenizer(String str); static String quoteIfNeeded(String s, String delim); static String quote(String s); static void quoteOnly(Appendable buffer, String input); static void quote(Appendable buffer, String input); static String unquoteOnly(String s); static String unquoteOnly(String s, boolean lenient); static String unquote(String s); static String unquote(String s, boolean lenient); static boolean isQuoted(String s); @Override boolean hasMoreTokens(); @Override String nextToken(); @Override String nextToken(String delim); @Override boolean hasMoreElements(); @Override Object nextElement(); @Override int countTokens(); boolean getDouble(); void setDouble(boolean d); boolean getSingle(); void setSingle(boolean single);  }
@Test void testNextTokenOnContentDisposition() { String content_disposition = "form-data; name=\"fileup\"; filename=\"Taken on Aug 22 \\ 2012.jpg\""; QuotedStringTokenizer tok = new QuotedStringTokenizer(content_disposition, ";", false, true); assertEquals("form-data", tok.nextToken().trim()); assertEquals("name=\"fileup\"", tok.nextToken().trim()); assertEquals("filename=\"Taken on Aug 22 \\ 2012.jpg\"", tok.nextToken().trim()); }