src/share/classes/sun/awt/datatransfer/DataTransferer.java

Print this page




  56 import java.nio.CharBuffer;
  57 import java.nio.charset.Charset;
  58 import java.nio.charset.CharsetEncoder;
  59 import java.nio.charset.IllegalCharsetNameException;
  60 import java.nio.charset.StandardCharsets;
  61 import java.nio.charset.UnsupportedCharsetException;
  62 
  63 import java.lang.reflect.Constructor;
  64 import java.lang.reflect.InvocationTargetException;
  65 import java.lang.reflect.Method;
  66 import java.lang.reflect.Modifier;
  67 
  68 import java.security.AccessController;
  69 import java.security.PrivilegedAction;
  70 import java.security.PrivilegedActionException;
  71 import java.security.PrivilegedExceptionAction;
  72 import java.security.ProtectionDomain;
  73 
  74 import java.util.*;
  75 

  76 import sun.util.logging.PlatformLogger;
  77 
  78 import sun.awt.AppContext;
  79 import sun.awt.SunToolkit;
  80 
  81 import java.awt.image.BufferedImage;
  82 import java.awt.image.ImageObserver;
  83 import java.awt.image.RenderedImage;
  84 import java.awt.image.WritableRaster;
  85 import java.awt.image.ColorModel;
  86 
  87 import javax.imageio.ImageIO;
  88 import javax.imageio.ImageReader;
  89 import javax.imageio.ImageReadParam;
  90 import javax.imageio.ImageWriter;
  91 import javax.imageio.ImageTypeSpecifier;
  92 
  93 import javax.imageio.spi.ImageWriterSpi;
  94 
  95 import javax.imageio.stream.ImageInputStream;


 211         tempMap.put("richtext", Boolean.TRUE);
 212         tempMap.put("uri-list", Boolean.TRUE);
 213         tempMap.put("directory", Boolean.TRUE);
 214         tempMap.put("css", Boolean.TRUE);
 215         tempMap.put("calendar", Boolean.TRUE);
 216         tempMap.put("plain", Boolean.TRUE);
 217         tempMap.put("rtf", Boolean.FALSE);
 218         tempMap.put("tab-separated-values", Boolean.FALSE);
 219         tempMap.put("t140", Boolean.FALSE);
 220         tempMap.put("rfc822-headers", Boolean.FALSE);
 221         tempMap.put("parityfec", Boolean.FALSE);
 222         textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
 223     }
 224 
 225     /**
 226      * The accessor method for the singleton DataTransferer instance. Note
 227      * that in a headless environment, there may be no DataTransferer instance;
 228      * instead, null will be returned.
 229      */
 230     public static synchronized DataTransferer getInstance() {
 231         return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
 232     }
 233 
 234     /**
 235      * Converts an arbitrary text encoding to its canonical name.
 236      */
 237     public static String canonicalName(String encoding) {
 238         if (encoding == null) {
 239             return null;
 240         }
 241         try {
 242             return Charset.forName(encoding).name();
 243         } catch (IllegalCharsetNameException icne) {
 244             return encoding;
 245         } catch (UnsupportedCharsetException uce) {
 246             return encoding;
 247         }
 248     }
 249 
 250     /**
 251      * If the specified flavor is a text flavor which supports the "charset"




  56 import java.nio.CharBuffer;
  57 import java.nio.charset.Charset;
  58 import java.nio.charset.CharsetEncoder;
  59 import java.nio.charset.IllegalCharsetNameException;
  60 import java.nio.charset.StandardCharsets;
  61 import java.nio.charset.UnsupportedCharsetException;
  62 
  63 import java.lang.reflect.Constructor;
  64 import java.lang.reflect.InvocationTargetException;
  65 import java.lang.reflect.Method;
  66 import java.lang.reflect.Modifier;
  67 
  68 import java.security.AccessController;
  69 import java.security.PrivilegedAction;
  70 import java.security.PrivilegedActionException;
  71 import java.security.PrivilegedExceptionAction;
  72 import java.security.ProtectionDomain;
  73 
  74 import java.util.*;
  75 
  76 import sun.awt.ComponentFactory;
  77 import sun.util.logging.PlatformLogger;
  78 
  79 import sun.awt.AppContext;
  80 import sun.awt.SunToolkit;
  81 
  82 import java.awt.image.BufferedImage;
  83 import java.awt.image.ImageObserver;
  84 import java.awt.image.RenderedImage;
  85 import java.awt.image.WritableRaster;
  86 import java.awt.image.ColorModel;
  87 
  88 import javax.imageio.ImageIO;
  89 import javax.imageio.ImageReader;
  90 import javax.imageio.ImageReadParam;
  91 import javax.imageio.ImageWriter;
  92 import javax.imageio.ImageTypeSpecifier;
  93 
  94 import javax.imageio.spi.ImageWriterSpi;
  95 
  96 import javax.imageio.stream.ImageInputStream;


 212         tempMap.put("richtext", Boolean.TRUE);
 213         tempMap.put("uri-list", Boolean.TRUE);
 214         tempMap.put("directory", Boolean.TRUE);
 215         tempMap.put("css", Boolean.TRUE);
 216         tempMap.put("calendar", Boolean.TRUE);
 217         tempMap.put("plain", Boolean.TRUE);
 218         tempMap.put("rtf", Boolean.FALSE);
 219         tempMap.put("tab-separated-values", Boolean.FALSE);
 220         tempMap.put("t140", Boolean.FALSE);
 221         tempMap.put("rfc822-headers", Boolean.FALSE);
 222         tempMap.put("parityfec", Boolean.FALSE);
 223         textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
 224     }
 225 
 226     /**
 227      * The accessor method for the singleton DataTransferer instance. Note
 228      * that in a headless environment, there may be no DataTransferer instance;
 229      * instead, null will be returned.
 230      */
 231     public static synchronized DataTransferer getInstance() {
 232         return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
 233     }
 234 
 235     /**
 236      * Converts an arbitrary text encoding to its canonical name.
 237      */
 238     public static String canonicalName(String encoding) {
 239         if (encoding == null) {
 240             return null;
 241         }
 242         try {
 243             return Charset.forName(encoding).name();
 244         } catch (IllegalCharsetNameException icne) {
 245             return encoding;
 246         } catch (UnsupportedCharsetException uce) {
 247             return encoding;
 248         }
 249     }
 250 
 251     /**
 252      * If the specified flavor is a text flavor which supports the "charset"