equal
deleted
inserted
replaced
822 writeComments(bw, comments); |
822 writeComments(bw, comments); |
823 } |
823 } |
824 bw.write("#" + new Date().toString()); |
824 bw.write("#" + new Date().toString()); |
825 bw.newLine(); |
825 bw.newLine(); |
826 synchronized (this) { |
826 synchronized (this) { |
827 for (Enumeration e = keys(); e.hasMoreElements();) { |
827 for (Enumeration<?> e = keys(); e.hasMoreElements();) { |
828 String key = (String)e.nextElement(); |
828 String key = (String)e.nextElement(); |
829 String val = (String)get(key); |
829 String val = (String)get(key); |
830 key = saveConvert(key, true, escUnicode); |
830 key = saveConvert(key, true, escUnicode); |
831 /* No need to escape embedded and trailing spaces for value, hence |
831 /* No need to escape embedded and trailing spaces for value, hence |
832 * pass false to flag. |
832 * pass false to flag. |
985 * @see java.util.Enumeration |
985 * @see java.util.Enumeration |
986 * @see java.util.Properties#defaults |
986 * @see java.util.Properties#defaults |
987 * @see #stringPropertyNames |
987 * @see #stringPropertyNames |
988 */ |
988 */ |
989 public Enumeration<?> propertyNames() { |
989 public Enumeration<?> propertyNames() { |
990 Hashtable h = new Hashtable(); |
990 Hashtable<String,Object> h = new Hashtable<>(); |
991 enumerate(h); |
991 enumerate(h); |
992 return h.keys(); |
992 return h.keys(); |
993 } |
993 } |
994 |
994 |
995 /** |
995 /** |
1024 * @throws ClassCastException if any key in this property list |
1024 * @throws ClassCastException if any key in this property list |
1025 * is not a string. |
1025 * is not a string. |
1026 */ |
1026 */ |
1027 public void list(PrintStream out) { |
1027 public void list(PrintStream out) { |
1028 out.println("-- listing properties --"); |
1028 out.println("-- listing properties --"); |
1029 Hashtable h = new Hashtable(); |
1029 Hashtable<String,Object> h = new Hashtable<>(); |
1030 enumerate(h); |
1030 enumerate(h); |
1031 for (Enumeration e = h.keys() ; e.hasMoreElements() ;) { |
1031 for (Enumeration<String> e = h.keys() ; e.hasMoreElements() ;) { |
1032 String key = (String)e.nextElement(); |
1032 String key = e.nextElement(); |
1033 String val = (String)h.get(key); |
1033 String val = (String)h.get(key); |
1034 if (val.length() > 40) { |
1034 if (val.length() > 40) { |
1035 val = val.substring(0, 37) + "..."; |
1035 val = val.substring(0, 37) + "..."; |
1036 } |
1036 } |
1037 out.println(key + "=" + val); |
1037 out.println(key + "=" + val); |
1052 * method is duplicated in order to ensure that a non-1.1 compiler can |
1052 * method is duplicated in order to ensure that a non-1.1 compiler can |
1053 * compile this file. |
1053 * compile this file. |
1054 */ |
1054 */ |
1055 public void list(PrintWriter out) { |
1055 public void list(PrintWriter out) { |
1056 out.println("-- listing properties --"); |
1056 out.println("-- listing properties --"); |
1057 Hashtable h = new Hashtable(); |
1057 Hashtable<String,Object> h = new Hashtable<>(); |
1058 enumerate(h); |
1058 enumerate(h); |
1059 for (Enumeration e = h.keys() ; e.hasMoreElements() ;) { |
1059 for (Enumeration<String> e = h.keys() ; e.hasMoreElements() ;) { |
1060 String key = (String)e.nextElement(); |
1060 String key = e.nextElement(); |
1061 String val = (String)h.get(key); |
1061 String val = (String)h.get(key); |
1062 if (val.length() > 40) { |
1062 if (val.length() > 40) { |
1063 val = val.substring(0, 37) + "..."; |
1063 val = val.substring(0, 37) + "..."; |
1064 } |
1064 } |
1065 out.println(key + "=" + val); |
1065 out.println(key + "=" + val); |
1070 * Enumerates all key/value pairs in the specified hashtable. |
1070 * Enumerates all key/value pairs in the specified hashtable. |
1071 * @param h the hashtable |
1071 * @param h the hashtable |
1072 * @throws ClassCastException if any of the property keys |
1072 * @throws ClassCastException if any of the property keys |
1073 * is not of String type. |
1073 * is not of String type. |
1074 */ |
1074 */ |
1075 private synchronized void enumerate(Hashtable h) { |
1075 private synchronized void enumerate(Hashtable<String,Object> h) { |
1076 if (defaults != null) { |
1076 if (defaults != null) { |
1077 defaults.enumerate(h); |
1077 defaults.enumerate(h); |
1078 } |
1078 } |
1079 for (Enumeration e = keys() ; e.hasMoreElements() ;) { |
1079 for (Enumeration<?> e = keys() ; e.hasMoreElements() ;) { |
1080 String key = (String)e.nextElement(); |
1080 String key = (String)e.nextElement(); |
1081 h.put(key, get(key)); |
1081 h.put(key, get(key)); |
1082 } |
1082 } |
1083 } |
1083 } |
1084 |
1084 |
1089 */ |
1089 */ |
1090 private synchronized void enumerateStringProperties(Hashtable<String, String> h) { |
1090 private synchronized void enumerateStringProperties(Hashtable<String, String> h) { |
1091 if (defaults != null) { |
1091 if (defaults != null) { |
1092 defaults.enumerateStringProperties(h); |
1092 defaults.enumerateStringProperties(h); |
1093 } |
1093 } |
1094 for (Enumeration e = keys() ; e.hasMoreElements() ;) { |
1094 for (Enumeration<?> e = keys() ; e.hasMoreElements() ;) { |
1095 Object k = e.nextElement(); |
1095 Object k = e.nextElement(); |
1096 Object v = get(k); |
1096 Object v = get(k); |
1097 if (k instanceof String && v instanceof String) { |
1097 if (k instanceof String && v instanceof String) { |
1098 h.put((String) k, (String) v); |
1098 h.put((String) k, (String) v); |
1099 } |
1099 } |