257 tempMap.put("richtext", Boolean.TRUE);
258 tempMap.put("uri-list", Boolean.TRUE);
259 tempMap.put("directory", Boolean.TRUE);
260 tempMap.put("css", Boolean.TRUE);
261 tempMap.put("calendar", Boolean.TRUE);
262 tempMap.put("plain", Boolean.TRUE);
263 tempMap.put("rtf", Boolean.FALSE);
264 tempMap.put("tab-separated-values", Boolean.FALSE);
265 tempMap.put("t140", Boolean.FALSE);
266 tempMap.put("rfc822-headers", Boolean.FALSE);
267 tempMap.put("parityfec", Boolean.FALSE);
268 textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
269 }
270
271 /**
272 * The accessor method for the singleton DataTransferer instance. Note
273 * that in a headless environment, there may be no DataTransferer instance;
274 * instead, null will be returned.
275 */
276 public static synchronized DataTransferer getInstance() {
277 return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
278 }
279
280 /**
281 * Converts an arbitrary text encoding to its canonical name.
282 */
283 public static String canonicalName(String encoding) {
284 if (encoding == null) {
285 return null;
286 }
287 try {
288 return Charset.forName(encoding).name();
289 } catch (IllegalCharsetNameException icne) {
290 return encoding;
291 } catch (UnsupportedCharsetException uce) {
292 return encoding;
293 }
294 }
295
296 /**
297 * If the specified flavor is a text flavor which supports the "charset"
|
257 tempMap.put("richtext", Boolean.TRUE);
258 tempMap.put("uri-list", Boolean.TRUE);
259 tempMap.put("directory", Boolean.TRUE);
260 tempMap.put("css", Boolean.TRUE);
261 tempMap.put("calendar", Boolean.TRUE);
262 tempMap.put("plain", Boolean.TRUE);
263 tempMap.put("rtf", Boolean.FALSE);
264 tempMap.put("tab-separated-values", Boolean.FALSE);
265 tempMap.put("t140", Boolean.FALSE);
266 tempMap.put("rfc822-headers", Boolean.FALSE);
267 tempMap.put("parityfec", Boolean.FALSE);
268 textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
269 }
270
271 /**
272 * The accessor method for the singleton DataTransferer instance. Note
273 * that in a headless environment, there may be no DataTransferer instance;
274 * instead, null will be returned.
275 */
276 public static synchronized DataTransferer getInstance() {
277 return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
278 }
279
280 /**
281 * Converts an arbitrary text encoding to its canonical name.
282 */
283 public static String canonicalName(String encoding) {
284 if (encoding == null) {
285 return null;
286 }
287 try {
288 return Charset.forName(encoding).name();
289 } catch (IllegalCharsetNameException icne) {
290 return encoding;
291 } catch (UnsupportedCharsetException uce) {
292 return encoding;
293 }
294 }
295
296 /**
297 * If the specified flavor is a text flavor which supports the "charset"
|