< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ParameterList.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 42,61 **** * @author John Mani */ public final class ParameterList { ! private final HashMap list; /** * No-arg Constructor. */ public ParameterList() { ! this.list = new HashMap(); } ! private ParameterList(HashMap m) { this.list = m; } /** * Constructor that takes a parameter-list string. The String --- 42,61 ---- * @author John Mani */ public final class ParameterList { ! private final HashMap<String, String> list; /** * No-arg Constructor. */ public ParameterList() { ! this.list = new HashMap<String, String>(); } ! private ParameterList(HashMap<String, String> m) { this.list = m; } /** * Constructor that takes a parameter-list string. The String
*** 71,81 **** HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; int type; String name; ! list = new HashMap(); while (true) { tk = h.next(); type = tk.getType(); if (type == HeaderTokenizer.Token.EOF) // done --- 71,81 ---- HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; int type; String name; ! list = new HashMap<String, String>(); while (true) { tk = h.next(); type = tk.getType(); if (type == HeaderTokenizer.Token.EOF) // done
*** 128,138 **** * @return Value of the parameter. Returns * <code>null</code> if the parameter is not * present. */ public String get(String name) { ! return (String)list.get(name.trim().toLowerCase()); } /** * Set a parameter. If this parameter already exists, it is * replaced by this new value. --- 128,138 ---- * @return Value of the parameter. Returns * <code>null</code> if the parameter is not * present. */ public String get(String name) { ! return list.get(name.trim().toLowerCase()); } /** * Set a parameter. If this parameter already exists, it is * replaced by this new value.
*** 158,168 **** * Return an enumeration of the names of all parameters in this * list. * * @return Enumeration of all parameter names in this list. */ ! public Iterator getNames() { return list.keySet().iterator(); } /** --- 158,168 ---- * Return an enumeration of the names of all parameters in this * list. * * @return Enumeration of all parameter names in this list. */ ! public Iterator<String> getNames() { return list.keySet().iterator(); } /**
*** 188,204 **** * the field into which the parameter list is to * be inserted. * @return String */ public String toString(int used) { ! StringBuffer sb = new StringBuffer(); ! Iterator itr = list.entrySet().iterator(); while (itr.hasNext()) { ! Map.Entry e = (Map.Entry)itr.next(); ! String name = (String)e.getKey(); ! String value = quote((String)e.getValue()); sb.append("; "); used += 2; int len = name.length() + value.length() + 1; if (used + len > 76) { // overflows ... sb.append("\r\n\t"); // .. start new continuation line --- 188,204 ---- * the field into which the parameter list is to * be inserted. * @return String */ public String toString(int used) { ! StringBuilder sb = new StringBuilder(); ! Iterator<Map.Entry<String, String>> itr = list.entrySet().iterator(); while (itr.hasNext()) { ! Map.Entry<String, String> e = itr.next(); ! String name = e.getKey(); ! String value = quote(e.getValue()); sb.append("; "); used += 2; int len = name.length() + value.length() + 1; if (used + len > 76) { // overflows ... sb.append("\r\n\t"); // .. start new continuation line
< prev index next >