/[classpath]/classpath/java/awt/datatransfer/DataFlavor.java
ViewVC logotype

Diff of /classpath/java/awt/datatransfer/DataFlavor.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by mark, Fri Aug 5 17:26:57 2005 UTC revision 1.26 by roehrijn, Mon Nov 21 01:58:27 2005 UTC
# Line 1  Line 1 
1  /* DataFlavor.java -- A type of data to transfer via the clipboard.  /* DataFlavor.java -- A type of data to transfer via the clipboard.
2     Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc.     Copyright (C) 1999, 2001, 2004, 2005 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 63  public class DataFlavor implements java. Line 63  public class DataFlavor implements java.
63    
64    // FIXME: Serialization: Need to write methods for.    // FIXME: Serialization: Need to write methods for.
65    
66  /**    /**
67   * This is the data flavor used for tranferring plain text.  The MIME     * This is the data flavor used for tranferring plain text.  The MIME
68   * type is "text/plain; charset=unicode".  The representation class     * type is "text/plain; charset=unicode".  The representation class
69   * is <code>java.io.InputStream</code>.     * is <code>java.io.InputStream</code>.
70   *     *
71   * @deprecated The charset unicode is platform specific and InputStream     * @deprecated The charset unicode is platform specific and InputStream
72   * deals with bytes not chars. Use <code>getRederForText()</code>.     * deals with bytes not chars. Use <code>getRederForText()</code>.
73   */     */
74  public static final DataFlavor plainTextFlavor;    public static final DataFlavor plainTextFlavor;
   
 /**  
  * This is the data flavor used for transferring Java strings.  The  
  * MIME type is "application/x-java-serialized-object" and the  
  * representation class is <code>java.lang.String</code>.  
  */  
 public static final DataFlavor stringFlavor;  
   
 /**  
  * This is a data flavor used for transferring lists of files.  The  
  * representation type is a <code>java.util.List</code>, with each element of  
  * the list being a <code>java.io.File</code>.  
  */  
 public static final DataFlavor javaFileListFlavor;  
   
 /**  
  * This is an image flavor used for transferring images.  The  
  * representation type is a <code>java.awt.Image</code>.  
  */  
 public static final DataFlavor imageFlavor;  
   
 /**  
  * This is the MIME type used for transferring a serialized object.  
  * The representation class is the type of object be deserialized.  
  */  
 public static final String javaSerializedObjectMimeType =  
   "application/x-java-serialized-object";  
   
 /**  
  * This is the MIME type used to transfer a Java object reference within  
  * the same JVM.  The representation class is the class of the object  
  * being transferred.  
  */  
 public static final String javaJVMLocalObjectMimeType =  
   "application/x-java-jvm-local-objectref";  
   
 /**  
  * This is the MIME type used to transfer a link to a remote object.  
  * The representation class is the type of object being linked to.  
  */  
 public static final String javaRemoteObjectMimeType =  
   "application/x-java-remote-object";  
   
 static  
 {  
   plainTextFlavor  
       = new DataFlavor(java.io.InputStream.class,  
                        "text/plain; charset=unicode",  
                        "plain unicode text");  
   
   stringFlavor  
       = new DataFlavor(java.lang.String.class,  
                        "Java Unicode String");  
   
   javaFileListFlavor  
       = new DataFlavor(java.util.List.class,  
                        "application/x-java-file-list; class=java.util.List",  
                        "Java File List");  
   
   imageFlavor  
       = new DataFlavor(java.awt.Image.class,  
                        "Java Image");  
 }  
75    
76  /*************************************************************************/    /**
77       * This is the data flavor used for transferring Java strings.  The
78       * MIME type is "application/x-java-serialized-object" and the
79       * representation class is <code>java.lang.String</code>.
80       */
81      public static final DataFlavor stringFlavor;
82    
83  /*    /**
84   * Instance Variables     * This is a data flavor used for transferring lists of files.  The
85   */     * representation type is a <code>java.util.List</code>, with each
86       * element of the list being a <code>java.io.File</code>.
87       */
88      public static final DataFlavor javaFileListFlavor;
89    
90  // The MIME type for this flavor    /**
91  private final String mimeType;     * This is an image flavor used for transferring images.  The
92       * representation type is a <code>java.awt.Image</code>.
93       */
94      public static final DataFlavor imageFlavor;
95    
96  // The representation class for this flavor    /**
97  private final Class representationClass;     * This is the MIME type used for transferring a serialized object.
98       * The representation class is the type of object be deserialized.
99       */
100      public static final String javaSerializedObjectMimeType =
101        "application/x-java-serialized-object";
102    
103  // The human readable name of this flavor    /**
104  private String humanPresentableName;     * This is the MIME type used to transfer a Java object reference within
105       * the same JVM.  The representation class is the class of the object
106       * being transferred.
107       */
108      public static final String javaJVMLocalObjectMimeType =
109        "application/x-java-jvm-local-objectref";
110    
111  /*************************************************************************/    /**
112       * This is the MIME type used to transfer a link to a remote object.
113       * The representation class is the type of object being linked to.
114       */
115      public static final String javaRemoteObjectMimeType =
116        "application/x-java-remote-object";
117    
118  /*    static
119   * Static Methods    {
120   */      plainTextFlavor
121            = new DataFlavor(java.io.InputStream.class,
122                            "text/plain; charset=unicode",
123                            "plain unicode text");
124      
125        stringFlavor
126            = new DataFlavor(java.lang.String.class,
127                            "Java Unicode String");
128      
129        javaFileListFlavor
130            = new DataFlavor(java.util.List.class,
131                            "application/x-java-file-list; class=java.util.List",
132                            "Java File List");
133      
134        imageFlavor
135            = new DataFlavor(java.awt.Image.class,
136                             "Java Image");
137      }
138    
 /**  
  * This method attempts to load the named class.  The following class  
  * loaders are searched in order: the bootstrap class loader, the  
  * system class loader, the context class loader (if it exists), and  
  * the specified fallback class loader.  
  *  
  * @param className The name of the class to load.  
  * @param classLoader The class loader to use if all others fail, which  
  * may be <code>null</code>.  
  *  
  * @exception ClassNotFoundException If the class cannot be loaded.  
  */  
 protected static final Class  
 tryToLoadClass(String className, ClassLoader classLoader)  
                throws ClassNotFoundException  
 {  
   try  
     {  
       return(Class.forName(className));  
     }  
   catch(Exception e) { ; }  
   // Commented out for Java 1.1  
139    /*    /*
140    try     * Instance Variables
141      {     */
142        return(className.getClass().getClassLoader().findClass(className));    
143      }    // The MIME type for this flavor
144    catch(Exception e) { ; }    private final String mimeType;
145      
146    try    // The representation class for this flavor
147      {    private final Class representationClass;
148        return(ClassLoader.getSystemClassLoader().findClass(className));    
149      }    // The human readable name of this flavor
150    catch(Exception e) { ; }    private String humanPresentableName;
   */  
151    
   // FIXME: What is the context class loader?  
152    /*    /*
153    try     * Static Methods
154      {     */
155      }    
156    catch(Exception e) { ; }    /**
157    */     * This method attempts to load the named class.  The following class
158       * loaders are searched in order: the bootstrap class loader, the
159    if (classLoader != null)     * system class loader, the context class loader (if it exists), and
160      return(classLoader.loadClass(className));     * the specified fallback class loader.
161    else     *
162      throw new ClassNotFoundException(className);     * @param className The name of the class to load.
163  }     * @param classLoader The class loader to use if all others fail, which
164       * may be <code>null</code>.
165  /*************************************************************************/     *
166       * @exception ClassNotFoundException If the class cannot be loaded.
167  /*     */
168   * Constructors    protected static final Class tryToLoadClass(String className,
169   */                                               ClassLoader classLoader)
170        throws ClassNotFoundException
171      {
172        try
173          {
174            return(Class.forName(className));
175          }
176        catch(Exception e) { ; }
177        // Commented out for Java 1.1
178        /*
179        try
180          {
181            return(className.getClass().getClassLoader().findClass(className));
182          }
183        catch(Exception e) { ; }
184      
185        try
186          {
187            return(ClassLoader.getSystemClassLoader().findClass(className));
188          }
189        catch(Exception e) { ; }
190        */
191      
192        // FIXME: What is the context class loader?
193        /*
194        try
195          {
196          }
197        catch(Exception e) { ; }
198        */
199      
200        if (classLoader != null)
201          return(classLoader.loadClass(className));
202        else
203          throw new ClassNotFoundException(className);
204      }
205    
206  /**    /*
207   * Empty public constructor needed for externalization.     * Constructors
208   * Should not be used for normal instantiation.     */
209   */    
210  public    /**
211  DataFlavor()     * Empty public constructor needed for externalization.
212  {     * Should not be used for normal instantiation.
213       */
214      public DataFlavor()
215      {
216      mimeType = null;      mimeType = null;
217      representationClass = null;      representationClass = null;
218      humanPresentableName = null;      humanPresentableName = null;
219  }    }
   
 /*************************************************************************/  
220    
221  /**    /**
222   * Private constructor.     * Private constructor.
223   */     */
224  private    private DataFlavor(Class representationClass,
225  DataFlavor(Class representationClass,                      String mimeType,
226             String mimeType,                      String humanPresentableName)
227             String humanPresentableName)    {
 {  
228      this.representationClass = representationClass;      this.representationClass = representationClass;
229      this.mimeType = mimeType;      this.mimeType = mimeType;
230      if (humanPresentableName != null)      if (humanPresentableName != null)
231          this.humanPresentableName = humanPresentableName;        this.humanPresentableName = humanPresentableName;
232      else      else
233          this.humanPresentableName = mimeType;        this.humanPresentableName = mimeType;
234  }    }
   
 /*************************************************************************/  
235    
236  /**    /**
237   * Initializes a new instance of <code>DataFlavor</code>.  The class     * Initializes a new instance of <code>DataFlavor</code>.  The class
238   * and human readable name are specified, the MIME type will be     * and human readable name are specified, the MIME type will be
239   * "application/x-java-serialized-object". If the human readable name     * "application/x-java-serialized-object". If the human readable name
240   * is not specified (<code>null</code>) then the human readable name     * is not specified (<code>null</code>) then the human readable name
241   * will be the same as the MIME type.     * will be the same as the MIME type.
242   *     *
243   * @param representationClass The representation class for this object.     * @param representationClass The representation class for this object.
244   * @param humanPresentableName The display name of the object.     * @param humanPresentableName The display name of the object.
245   */     */
246  public    public DataFlavor(Class representationClass, String humanPresentableName)
247  DataFlavor(Class representationClass, String humanPresentableName)    {
 {  
248      this(representationClass,      this(representationClass,
249         "application/x-java-serialized-object"           "application/x-java-serialized-object"
250         + "; class="           + "; class="
251         + representationClass.getName(),           + representationClass.getName(),
252         humanPresentableName);           humanPresentableName);
253  }    }
   
 /*************************************************************************/  
254    
255  /**    /**
256   * Initializes a new instance of <code>DataFlavor</code> with the     * Initializes a new instance of <code>DataFlavor</code> with the
257   * specified MIME type and description.  If the MIME type has a     * specified MIME type and description.  If the MIME type has a
258   * "class=&lt;rep class&gt;" parameter then the representation class will     * "class=&lt;rep class&gt;" parameter then the representation class will
259   * be the class name specified. Otherwise the class defaults to     * be the class name specified. Otherwise the class defaults to
260   * <code>java.io.InputStream</code>. If the human readable name     * <code>java.io.InputStream</code>. If the human readable name
261   * is not specified (<code>null</code>) then the human readable name     * is not specified (<code>null</code>) then the human readable name
262   * will be the same as the MIME type.     * will be the same as the MIME type.
263   *     *
264   * @param mimeType The MIME type for this flavor.     * @param mimeType The MIME type for this flavor.
265   * @param humanPresentableName The display name of this flavor.     * @param humanPresentableName The display name of this flavor.
266   * @param classLoader The class loader for finding classes if the default     * @param classLoader The class loader for finding classes if the default
267   * class loaders do not work.     * class loaders do not work.
268   *     *
269   * @exception IllegalArgumentException If the representation class     * @exception IllegalArgumentException If the representation class
270   * specified cannot be loaded.     * specified cannot be loaded.
271   * @exception ClassNotFoundException If the class is not loaded.     * @exception ClassNotFoundException If the class is not loaded.
272   */     */
273  public    public DataFlavor(String mimeType, String humanPresentableName,
274  DataFlavor(String mimeType, String humanPresentableName,                     ClassLoader classLoader)
275             ClassLoader classLoader) throws ClassNotFoundException      throws ClassNotFoundException
276  {    {
277    this(getRepresentationClassFromMime(mimeType, classLoader),      this(getRepresentationClassFromMime(mimeType, classLoader),
278         mimeType, humanPresentableName);           mimeType, humanPresentableName);
279  }    }
280    
281  private static Class    private static Class getRepresentationClassFromMime(String mimeString,
282  getRepresentationClassFromMime(String mimeString, ClassLoader classLoader)                                                       ClassLoader classLoader)
283  {    {
284    String classname = getParameter("class", mimeString);      String classname = getParameter("class", mimeString);
285    if (classname != null)      if (classname != null)
286      {        {
287        try          try
288          {            {
289            return tryToLoadClass(classname, classLoader);              return tryToLoadClass(classname, classLoader);
290          }            }
291        catch(Exception e)          catch(Exception e)
292          {            {
293            throw new IllegalArgumentException("classname: " + e.getMessage());              throw new IllegalArgumentException("classname: " + e.getMessage());
294          }            }
295      }        }
296    else      else
     {  
297        return java.io.InputStream.class;        return java.io.InputStream.class;
298      }    }
 }  
   
 /*************************************************************************/  
   
 /**  
  * Initializes a new instance of <code>DataFlavor</code> with the  
  * specified MIME type and description.  If the MIME type has a  
  * "class=&lt;rep class&gt;" parameter then the representation class will  
  * be the class name specified. Otherwise the class defaults to  
  * <code>java.io.InputStream</code>. If the human readable name  
  * is not specified (<code>null</code>) then the human readable name  
  * will be the same as the MIME type. This is the same as calling  
  * <code>new DataFlavor(mimeType, humanPresentableName, null)</code>.  
  *  
  * @param mimeType The MIME type for this flavor.  
  * @param humanPresentableName The display name of this flavor.  
  *  
  * @exception IllegalArgumentException If the representation class  
  * specified cannot be loaded.  
  */  
 public  
 DataFlavor(String mimeType, String humanPresentableName)  
 {  
   this (getRepresentationClassFromMime (mimeType, null),  
         mimeType, humanPresentableName);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Initializes a new instance of <code>DataFlavor</code> with the specified  
  * MIME type.  This type can have a "class=" parameter to specify the  
  * representation class, and then the class must exist or an exception will  
  * be thrown. If there is no "class=" parameter then the representation class  
  * will be <code>java.io.InputStream</code>. This is the same as calling  
  * <code>new DataFlavor(mimeType, null)</code>.  
  *  
  * @param mimeType The MIME type for this flavor.  
  *  
  * @exception IllegalArgumentException If a class is not specified in  
  * the MIME type.  
  * @exception ClassNotFoundException If the class cannot be loaded.  
  */  
 public  
 DataFlavor(String mimeType) throws ClassNotFoundException  
 {  
   this(mimeType, null);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Returns the MIME type of this flavor.  
  *  
  * @return The MIME type for this flavor.  
  */  
 public String  
 getMimeType()  
 {  
   return(mimeType);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Returns the representation class for this flavor.  
  *  
  * @return The representation class for this flavor.  
  */  
 public Class  
 getRepresentationClass()  
 {  
   return(representationClass);  
 }  
   
 /*************************************************************************/  
299    
300  /**    /**
301   * Returns the human presentable name for this flavor.     * Initializes a new instance of <code>DataFlavor</code> with the
302   *     * specified MIME type and description.  If the MIME type has a
303   * @return The human presentable name for this flavor.     * "class=&lt;rep class&gt;" parameter then the representation class will
304   */     * be the class name specified. Otherwise the class defaults to
305  public String     * <code>java.io.InputStream</code>. If the human readable name
306  getHumanPresentableName()     * is not specified (<code>null</code>) then the human readable name
307  {     * will be the same as the MIME type. This is the same as calling
308    return(humanPresentableName);     * <code>new DataFlavor(mimeType, humanPresentableName, null)</code>.
309  }     *
310       * @param mimeType The MIME type for this flavor.
311       * @param humanPresentableName The display name of this flavor.
312       *
313       * @exception IllegalArgumentException If the representation class
314       * specified cannot be loaded.
315       */
316      public DataFlavor(String mimeType, String humanPresentableName)
317      {
318        this(getRepresentationClassFromMime (mimeType, null),
319            mimeType, humanPresentableName);
320      }
321    
322  /*************************************************************************/    /**
323       * Initializes a new instance of <code>DataFlavor</code> with the specified
324       * MIME type.  This type can have a "class=" parameter to specify the
325       * representation class, and then the class must exist or an exception will
326       * be thrown. If there is no "class=" parameter then the representation class
327       * will be <code>java.io.InputStream</code>. This is the same as calling
328       * <code>new DataFlavor(mimeType, null)</code>.
329       *
330       * @param mimeType The MIME type for this flavor.
331       *
332       * @exception IllegalArgumentException If a class is not specified in
333       * the MIME type.
334       * @exception ClassNotFoundException If the class cannot be loaded.
335       */
336      public DataFlavor(String mimeType) throws ClassNotFoundException
337      {
338        this(mimeType, null);
339      }
340    
341  /**    /**
342   * Returns the primary MIME type for this flavor.     * Returns the MIME type of this flavor.
343   *     *
344   * @return The primary MIME type for this flavor.     * @return The MIME type for this flavor.
345   */     */
346  public String    public String getMimeType()
347  getPrimaryType()    {
 {  
   int idx = mimeType.indexOf("/");  
   if (idx == -1)  
348      return(mimeType);      return(mimeType);
349      }
350    
351    return(mimeType.substring(0, idx));    /**
352  }     * Returns the representation class for this flavor.
353       *
354  /*************************************************************************/     * @return The representation class for this flavor.
355       */
356  /**    public Class getRepresentationClass()
357   * Returns the MIME subtype for this flavor.    {
358   *      return(representationClass);
359   * @return The MIME subtype for this flavor.    }
  */  
 public String  
 getSubType()  
 {  
   int start = mimeType.indexOf("/");  
   if (start == -1)  
     return "";  
   
   int end = mimeType.indexOf(";", start + 1);  
   if (end == -1)  
     return mimeType.substring(start + 1);  
   else  
     return mimeType.substring(start + 1, end);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Returns the value of the named MIME type parameter, or <code>null</code>  
  * if the parameter does not exist. Given the parameter name and the mime  
  * string.  
  *  
  * @param paramName The name of the parameter.  
  * @param mimeString The mime string from where the name should be found.  
  *  
  * @return The value of the parameter or null.  
  */  
 private static String  
 getParameter(String paramName, String mimeString)  
 {  
   int idx = mimeString.indexOf(paramName + "=");  
   if (idx == -1)  
     return(null);  
   
   String value = mimeString.substring(idx + paramName.length() + 1);  
   
   idx = value.indexOf(" ");  
   if (idx == -1)  
     return(value);  
   else  
     return(value.substring(0, idx));  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Returns the value of the named MIME type parameter, or <code>null</code>  
  * if the parameter does not exist.  
  *  
  * @param paramName The name of the paramter.  
  *  
  * @return The value of the parameter.  
  */  
 public String  
 getParameter(String paramName)  
 {  
   if ("humanPresentableName".equals(paramName))  
     return getHumanPresentableName();  
   
   return getParameter(paramName, mimeType);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Sets the human presentable name to the specified value.  
  *  
  * @param humanPresentableName The new display name.  
  */  
 public void  
 setHumanPresentableName(String humanPresentableName)  
 {  
   this.humanPresentableName = humanPresentableName;  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests the MIME type of this object for equality against the specified  
  * MIME type. Ignores parameters.  
  *  
  * @param mimeType The MIME type to test against.  
  *  
  * @return <code>true</code> if the MIME type is equal to this object's  
  * MIME type (ignoring parameters), <code>false</code> otherwise.  
  *  
  * @exception NullPointerException If mimeType is null.  
  */  
 public boolean  
 isMimeTypeEqual(String mimeType)  
 {  
   String mime = getMimeType();  
   int i = mime.indexOf(";");  
   if (i != -1)  
     mime = mime.substring(0, i);  
   
   i = mimeType.indexOf(";");  
   if (i != -1)  
     mimeType = mimeType.substring(0, i);  
   
   return mime.equals(mimeType);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests the MIME type of this object for equality against the specified  
  * data flavor's MIME type  
  *  
  * @param flavor The flavor to test against.  
  *  
  * @return <code>true</code> if the flavor's MIME type is equal to this  
  * object's MIME type, <code>false</code> otherwise.  
  */  
 public final boolean  
 isMimeTypeEqual(DataFlavor flavor)  
 {  
   return(isMimeTypeEqual(flavor.getMimeType()));  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether or not this flavor represents a serialized object.  
  *  
  * @return <code>true</code> if this flavor represents a serialized  
  * object, <code>false</code> otherwise.  
  */  
 public boolean  
 isMimeTypeSerializedObject()  
 {  
   return(mimeType.startsWith(javaSerializedObjectMimeType));  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether or not this flavor has a representation class of  
  * <code>java.io.InputStream</code>.  
  *  
  * @return <code>true</code> if the representation class of this flavor  
  * is <code>java.io.InputStream</code>, <code>false</code> otherwise.  
  */  
 public boolean  
 isRepresentationClassInputStream()  
 {  
   return(representationClass.getName().equals("java.io.InputStream"));  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether the representation class for this flavor is  
  * serializable.  
  *  
  * @return <code>true</code> if the representation class is serializable,  
  * <code>false</code> otherwise.  
  */  
 public boolean  
 isRepresentationClassSerializable()  
 {  
   Class[] interfaces = representationClass.getInterfaces();  
   
   int i = 0;  
   while (i < interfaces.length)  
     {  
       if (interfaces[i].getName().equals("java.io.Serializable"))  
         return(true);  
       ++i;  
     }  
   
   return(false);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether the representation class for his flavor is remote.  
  *  
  * @return <code>true</code> if the representation class is remote,  
  * <code>false</code> otherwise.  
  */  
 public boolean  
 isRepresentationClassRemote()  
 {  
   return Remote.class.isAssignableFrom (representationClass);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether or not this flavor represents a serialized object.  
  *  
  * @return <code>true</code> if this flavor represents a serialized  
  * object, <code>false</code> otherwise.  
  */  
 public boolean  
 isFlavorSerializedObjectType()  
 {  
   // FIXME: What is the diff between this and isMimeTypeSerializedObject?  
   return(mimeType.startsWith(javaSerializedObjectMimeType));  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Tests whether or not this flavor represents a remote object.  
  *  
  * @return <code>true</code> if this flavor represents a remote object,  
  * <code>false</code> otherwise.  
  */  
 public boolean  
 isFlavorRemoteObjectType()  
 {  
   return(mimeType.startsWith(javaRemoteObjectMimeType));  
 }  
   
 /*************************************************************************/  
360    
361  /**    /**
362   * Tests whether or not this flavor represents a list of files.     * Returns the human presentable name for this flavor.
363   *     *
364   * @return <code>true</code> if this flavor represents a list of files,     * @return The human presentable name for this flavor.
365   * <code>false</code> otherwise.     */
366   */    public String getHumanPresentableName()
367  public boolean    {
368  isFlavorJavaFileListType()      return(humanPresentableName);
369  {    }
   if (this.mimeType.equals(javaFileListFlavor.mimeType) &&  
       this.representationClass.equals(javaFileListFlavor.representationClass))  
     return(true);  
370    
371    return(false);    /**
372  }     * Returns the primary MIME type for this flavor.
373       *
374       * @return The primary MIME type for this flavor.
375       */
376      public String getPrimaryType()
377      {
378        int idx = mimeType.indexOf("/");
379        if (idx == -1)
380          return(mimeType);
381      
382        return(mimeType.substring(0, idx));
383      }
384    
385  /*************************************************************************/    /**
386       * Returns the MIME subtype for this flavor.
387       *
388       * @return The MIME subtype for this flavor.
389       */
390      public String getSubType()
391      {
392        int start = mimeType.indexOf("/");
393        if (start == -1)
394          return "";
395      
396        int end = mimeType.indexOf(";", start + 1);
397        if (end == -1)
398          return mimeType.substring(start + 1);
399        else
400          return mimeType.substring(start + 1, end);
401      }
402    
403  /**    /**
404   * Returns a copy of this object.     * Returns the value of the named MIME type parameter, or <code>null</code>
405   *     * if the parameter does not exist. Given the parameter name and the mime
406   * @return A copy of this object.     * string.
407   *     *
408   * @exception CloneNotSupportedException If the object's class does not support     * @param paramName The name of the parameter.
409   * the Cloneable interface. Subclasses that override the clone method can also     * @param mimeString The mime string from where the name should be found.
410   * throw this exception to indicate that an instance cannot be cloned.     *
411   */     * @return The value of the parameter or null.
412  public Object clone () throws CloneNotSupportedException     */
413  {    private static String getParameter(String paramName, String mimeString)
414    try    {
415      {      int idx = mimeString.indexOf(paramName + "=");
416        return(super.clone());      if (idx == -1)
     }  
   catch(Exception e)  
     {  
417        return(null);        return(null);
418      }    
419  }      String value = mimeString.substring(idx + paramName.length() + 1);
420      
421  /*************************************************************************/      idx = value.indexOf(" ");
422        if (idx == -1)
423  /**        return(value);
424   * This method test the specified <code>DataFlavor</code> for equality      else
425   * against this object.  This will be true if the MIME type and        return(value.substring(0, idx));
426   * representation type are the equal.    }
  *  
  * @param flavor The <code>DataFlavor</code> to test against.  
  *  
  * @return <code>true</code> if the flavor is equal to this object,  
  * <code>false</code> otherwise.  
  */  
 public boolean  
 equals(DataFlavor flavor)  
 {  
   if (flavor == null)  
     return(false);  
   
   if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase()))  
     return(false);  
427    
428    if (!this.representationClass.equals(flavor.representationClass))    /**
429      return(false);     * Returns the value of the named MIME type parameter, or <code>null</code>
430       * if the parameter does not exist.
431       *
432       * @param paramName The name of the paramter.
433       *
434       * @return The value of the parameter.
435       */
436      public String getParameter(String paramName)
437      {
438        if ("humanPresentableName".equals(paramName))
439          return getHumanPresentableName();
440      
441        return getParameter(paramName, mimeType);
442      }
443    
444    return(true);    /**
445  }     * Sets the human presentable name to the specified value.
446       *
447       * @param humanPresentableName The new display name.
448       */
449      public void setHumanPresentableName(String humanPresentableName)
450      {
451        this.humanPresentableName = humanPresentableName;
452      }
453    
454  /*************************************************************************/    /**
455       * Tests the MIME type of this object for equality against the specified
456       * MIME type. Ignores parameters.
457       *
458       * @param mimeType The MIME type to test against.
459       *
460       * @return <code>true</code> if the MIME type is equal to this object's
461       * MIME type (ignoring parameters), <code>false</code> otherwise.
462       *
463       * @exception NullPointerException If mimeType is null.
464       */
465      public boolean isMimeTypeEqual(String mimeType)
466      {
467        String mime = getMimeType();
468        int i = mime.indexOf(";");
469        if (i != -1)
470          mime = mime.substring(0, i);
471      
472        i = mimeType.indexOf(";");
473        if (i != -1)
474          mimeType = mimeType.substring(0, i);
475      
476        return mime.equals(mimeType);
477      }
478    
479  /**    /**
480   * This method test the specified <code>Object</code> for equality     * Tests the MIME type of this object for equality against the specified
481   * against this object.  This will be true if the following conditions     * data flavor's MIME type
482   * are met:     *
483   * <p>     * @param flavor The flavor to test against.
484   * <ul>     *
485   * <li>The object is not <code>null</code>.</li>     * @return <code>true</code> if the flavor's MIME type is equal to this
486   * <li>The object is an instance of <code>DataFlavor</code>.</li>     * object's MIME type, <code>false</code> otherwise.
487   * <li>The object's MIME type and representation class are equal to     */
488   * this object's.</li>    public final boolean isMimeTypeEqual(DataFlavor flavor)
489   * </ul>    {
490   *      return isMimeTypeEqual(flavor.getMimeType());
491   * @param obj The <code>Object</code> to test against.    }
  *  
  * @return <code>true</code> if the flavor is equal to this object,  
  * <code>false</code> otherwise.  
  */  
 public boolean  
 equals(Object obj)  
 {  
   if (!(obj instanceof DataFlavor))  
     return(false);  
492    
493    return(equals((DataFlavor)obj));    /**
494  }     * Tests whether or not this flavor represents a serialized object.
495       *
496       * @return <code>true</code> if this flavor represents a serialized
497       * object, <code>false</code> otherwise.
498       */
499      public boolean isMimeTypeSerializedObject()
500      {
501        return mimeType.startsWith(javaSerializedObjectMimeType);
502      }
503    
504  /*************************************************************************/    /**
505       * Tests whether or not this flavor has a representation class of
506       * <code>java.io.InputStream</code>.
507       *
508       * @return <code>true</code> if the representation class of this flavor
509       * is <code>java.io.InputStream</code>, <code>false</code> otherwise.
510       */
511      public boolean isRepresentationClassInputStream()
512      {
513        return representationClass.getName().equals("java.io.InputStream");
514      }
515    
516  /**    /**
517   * Tests whether or not the specified string is equal to the MIME type     * Tests whether the representation class for this flavor is
518   * of this object.     * serializable.
519   *     *
520   * @param str The string to test against.     * @return <code>true</code> if the representation class is serializable,
521   *     * <code>false</code> otherwise.
522   * @return <code>true</code> if the string is equal to this object's MIME     */
523   * type, <code>false</code> otherwise.    public boolean isRepresentationClassSerializable()
524   *    {
525   * @deprecated Not compatible with <code>hashCode()</code>.      Class[] interfaces = representationClass.getInterfaces();
526   *             Use <code>isMimeTypeEqual()</code>    
527   */      int i = 0;
528  public boolean      while (i < interfaces.length)
529  equals(String str)        {
530  {          if (interfaces[i].getName().equals("java.io.Serializable"))
531    return(isMimeTypeEqual(str));            return true;
532  }          ++i;
533          }
534      
535        return false;
536      }
537    
538  /*************************************************************************/    /**
539       * Tests whether the representation class for his flavor is remote.
540       *
541       * @return <code>true</code> if the representation class is remote,
542       * <code>false</code> otherwise.
543       */
544      public boolean isRepresentationClassRemote()
545      {
546        return Remote.class.isAssignableFrom (representationClass);
547      }
548    
549  /**    /**
550   * Returns the hash code for this data flavor.     * Tests whether or not this flavor represents a serialized object.
551   * The hash code is based on the (lower case) mime type and the     *
552   * representation class.     * @return <code>true</code> if this flavor represents a serialized
553   */     * object, <code>false</code> otherwise.
554  public int     */
555  hashCode()    public boolean isFlavorSerializedObjectType()
556  {    {
557    return(mimeType.toLowerCase().hashCode()^representationClass.hashCode());      // FIXME: What is the diff between this and isMimeTypeSerializedObject?
558  }      return(mimeType.startsWith(javaSerializedObjectMimeType));
559      }
560    
561  /*************************************************************************/    /**
562       * Tests whether or not this flavor represents a remote object.
563       *
564       * @return <code>true</code> if this flavor represents a remote object,
565       * <code>false</code> otherwise.
566       */
567      public boolean isFlavorRemoteObjectType()
568      {
569        return(mimeType.startsWith(javaRemoteObjectMimeType));
570      }
571    
572  /**    /**
573   * Returns <code>true</code> when the given <code>DataFlavor</code>     * Tests whether or not this flavor represents a list of files.
574   * matches this one.     *
575   */     * @return <code>true</code> if this flavor represents a list of files,
576  public boolean     * <code>false</code> otherwise.
577  match(DataFlavor dataFlavor)     */
578  {    public boolean isFlavorJavaFileListType()
579    // XXX - How is this different from equals?    {
580    return(equals(dataFlavor));      if (mimeType.equals(javaFileListFlavor.mimeType)
581  }          && representationClass.equals(javaFileListFlavor.representationClass))
582          return true;
583      
584        return false ;
585      }
586    
587  /*************************************************************************/    /**
588       * Returns a copy of this object.
589       *
590       * @return A copy of this object.
591       *
592       * @exception CloneNotSupportedException If the object's class does not support
593       * the Cloneable interface. Subclasses that override the clone method can also
594       * throw this exception to indicate that an instance cannot be cloned.
595       */
596      public Object clone () throws CloneNotSupportedException
597      {
598        // FIXME - This cannot be right.
599        try
600          {
601            return super.clone();
602          }
603        catch(Exception e)
604          {
605            return null;
606          }
607      }
608    
609  /**    /**
610   * This method exists for backward compatibility.  It simply returns     * This method test the specified <code>DataFlavor</code> for equality
611   * the same name/value pair passed in.     * against this object.  This will be true if the MIME type and
612   *     * representation type are the equal.
613   * @param name The parameter name.     *
614   * @param value The parameter value.     * @param flavor The <code>DataFlavor</code> to test against.
615   *     *
616   * @return The name/value pair.     * @return <code>true</code> if the flavor is equal to this object,
617   *     * <code>false</code> otherwise.
618   * @deprecated     */
619   */    public boolean equals(DataFlavor flavor)
620  protected String    {
621  normalizeMimeTypeParameter(String name, String value)      if (flavor == null)
622  {        return false;
623    return(name + "=" + value);    
624  }      if (! this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase()))
625          return false;
626      
627        if (! this.representationClass.equals(flavor.representationClass))
628          return false;
629      
630        return true;
631      }
632    
633  /*************************************************************************/    /**
634       * This method test the specified <code>Object</code> for equality
635       * against this object.  This will be true if the following conditions
636       * are met:
637       * <p>
638       * <ul>
639       * <li>The object is not <code>null</code>.</li>
640       * <li>The object is an instance of <code>DataFlavor</code>.</li>
641       * <li>The object's MIME type and representation class are equal to
642       * this object's.</li>
643       * </ul>
644       *
645       * @param obj The <code>Object</code> to test against.
646       *
647       * @return <code>true</code> if the flavor is equal to this object,
648       * <code>false</code> otherwise.
649       */
650      public boolean equals(Object obj)
651      {
652        if (! (obj instanceof DataFlavor))
653          return false;
654      
655        return equals((DataFlavor) obj);
656      }
657    
658  /**    /**
659   * This method exists for backward compatibility.  It simply returns     * Tests whether or not the specified string is equal to the MIME type
660   * the MIME type string unchanged.     * of this object.
661   *     *
662   * @param type The MIME type.     * @param str The string to test against.
663   *     *
664   * @return The MIME type.     * @return <code>true</code> if the string is equal to this object's MIME
665   *     * type, <code>false</code> otherwise.
666   * @deprecated     *
667   */     * @deprecated Not compatible with <code>hashCode()</code>.
668  protected String     *             Use <code>isMimeTypeEqual()</code>
669  normalizeMimeType(String type)     */
670  {    public boolean equals(String str)
671    return(type);    {
672  }      return isMimeTypeEqual(str);
673      }
674    
675  /*************************************************************************/    /**
676       * Returns the hash code for this data flavor.
677       * The hash code is based on the (lower case) mime type and the
678       * representation class.
679       */
680      public int hashCode()
681      {
682        return mimeType.toLowerCase().hashCode() ^ representationClass.hashCode();
683      }
684    
685  /**    /**
686   * Serialize this class.     * Returns <code>true</code> when the given <code>DataFlavor</code>
687   *     * matches this one.
688   * @param stream The <code>ObjectOutput</code> stream to serialize to.     */
689   *    public boolean match(DataFlavor dataFlavor)
690   * @exception IOException If an error occurs.    {
691   */      // XXX - How is this different from equals?
692  public void      return equals(dataFlavor);
693  writeExternal(ObjectOutput stream) throws IOException    }
 {  
   // FIXME: Implement me  
 }  
694    
695  /*************************************************************************/    /**
696       * This method exists for backward compatibility.  It simply returns
697       * the same name/value pair passed in.
698       *
699       * @param name The parameter name.
700       * @param value The parameter value.
701       *
702       * @return The name/value pair.
703       *
704       * @deprecated
705       */
706      protected String normalizeMimeTypeParameter(String name, String value)
707      {
708        return name + "=" + value;
709      }
710    
711  /**    /**
712   * De-serialize this class.     * This method exists for backward compatibility.  It simply returns
713   *     * the MIME type string unchanged.
714   * @param stream The <code>ObjectInput</code> stream to deserialize from.     *
715   *     * @param type The MIME type.
716   * @exception IOException If an error ocurs.     *
717   * @exception ClassNotFoundException If the class for an object being restored     * @return The MIME type.
718   * cannot be found.     *
719   */     * @deprecated
720  public void     */
721  readExternal(ObjectInput stream) throws IOException, ClassNotFoundException    protected String normalizeMimeType(String type)
722  {    {
723    // FIXME: Implement me      return type;
724  }    }
725    
726  /*************************************************************************/    /**
727       * Serialize this class.
728       *
729       * @param stream The <code>ObjectOutput</code> stream to serialize to.
730       *
731       * @exception IOException If an error occurs.
732       */
733      public void writeExternal(ObjectOutput stream) throws IOException
734      {
735        // FIXME: Implement me
736      }
737    
 /**  
  * Returns a string representation of this DataFlavor. Including the  
  * representation class name, MIME type and human presentable name.  
  */  
 public String  
 toString()  
 {  
   return(getClass().getName()  
          + "[representationClass=" + getRepresentationClass().getName()  
          + ",mimeType=" + getMimeType()  
          + ",humanPresentableName=" + getHumanPresentableName()  
          + "]");  
 }  
738    
739  /*************************************************************************/    /**
740       * De-serialize this class.
741       *
742       * @param stream The <code>ObjectInput</code> stream to deserialize from.
743       *
744       * @exception IOException If an error ocurs.
745       * @exception ClassNotFoundException If the class for an object being restored
746       * cannot be found.
747       */
748      public void readExternal(ObjectInput stream)
749        throws IOException, ClassNotFoundException
750      {
751        // FIXME: Implement me
752      }
753    
754  /**    /**
755   * XXX - Currently returns <code>plainTextFlavor</code>.     * Returns a string representation of this DataFlavor. Including the
756   */     * representation class name, MIME type and human presentable name.
757  public static final DataFlavor     */
758  getTextPlainUnicodeFlavor()    public String toString()
759  {    {
760    return(plainTextFlavor);      return (getClass().getName()
761  }             + "[representationClass=" + getRepresentationClass().getName()
762               + ",mimeType=" + getMimeType()
763               + ",humanPresentableName=" + getHumanPresentableName()
764               + "]");
765      }
766    
767  /*************************************************************************/    /**
768       * XXX - Currently returns <code>plainTextFlavor</code>.
769       */
770      public static final DataFlavor getTextPlainUnicodeFlavor()
771      {
772        return plainTextFlavor;
773      }
774    
775  /**    /**
776   * XXX - Currently returns <code>java.io.InputStream</code>.     * XXX - Currently returns <code>java.io.InputStream</code>.
777   *     *
778   * @since 1.3     * @since 1.3
779   */     */
780  public final Class    public final Class getDefaultRepresentationClass()
781  getDefaultRepresentationClass()    {
782  {      return java.io.InputStream.class;
783    return(java.io.InputStream.class);    }
 }  
 /*************************************************************************/  
784    
785  /**    /**
786   * XXX - Currently returns <code>java.io.InputStream</code>.     * XXX - Currently returns <code>java.io.InputStream</code>.
787   */     */
788  public final String    public final String getDefaultRepresentationClassAsString()
789  getDefaultRepresentationClassAsString()    {
790  {      return getDefaultRepresentationClass().getName();
791    return(getDefaultRepresentationClass().getName());    }
 }  
792    
793  /*************************************************************************/    /**
794       * Selects the best supported text flavor on this implementation.
795       * Returns <code>null</code> when none of the given flavors is liked.
796       *
797       * The <code>DataFlavor</code> returned the first data flavor in the
798       * array that has either a representation class which is (a subclass of)
799       * <code>Reader</code> or <code>String</code>, or has a representation
800       * class which is (a subclass of) <code>InputStream</code> and has a
801       * primary MIME type of "text" and has an supported encoding.
802       */
803      public static final DataFlavor
804        selectBestTextFlavor(DataFlavor[] availableFlavors)
805      {
806        for(int i = 0; i < availableFlavors.length; i++)
807          {
808            DataFlavor df = availableFlavors[i];
809            Class c = df.representationClass;
810      
811            // A Reader or String is good.
812            if ((Reader.class.isAssignableFrom(c))
813               || (String.class.isAssignableFrom(c)))
814              return df;
815      
816            // A InputStream is good if the mime primary type is "text"
817            if ((InputStream.class.isAssignableFrom(c))
818               && ("text".equals(df.getPrimaryType())))
819              {
820                String encoding = availableFlavors[i].getParameter("charset");
821                if (encoding == null)
822                  encoding = "us-ascii";
823                Reader r = null;
824                try
825                  {
826                    // Try to construct a dummy reader with the found encoding
827                    r = new InputStreamReader
828                          (new ByteArrayInputStream(new byte[0]), encoding);
829                  }
830                catch(UnsupportedEncodingException uee) { /* ignore */ }
831    
832                if (r != null)
833                  return df;
834              }
835          }
836      
837        // Nothing found
838        return null;
839      }
840    
841  /**    /**
842   * Selects the best supported text flavor on this implementation.     * Creates a <code>Reader</code> for a given <code>Transferable</code>.
843   * Returns <code>null</code> when none of the given flavors is liked.     *
844   *     * If the representation class is a (subclass of) <code>Reader</code>
845   * The <code>DataFlavor</code> returned the first data flavor in the     * then an instance of the representation class is returned. If the
846   * array that has either a representation class which is (a subclass of)     * representatation class is a <code>String</code> then a
847   * <code>Reader</code> or <code>String</code>, or has a representation     * <code>StringReader</code> is returned. And if the representation class
848   * class which is (a subclass of) <code>InputStream</code> and has a     * is a (subclass of) <code>InputStream</code> and the primary MIME type
849   * primary MIME type of "text" and has an supported encoding.     * is "text" then a <code>InputStreamReader</code> for the correct charset
850   */     * encoding is returned.
851  public static final DataFlavor     *
852  selectBestTextFlavor(DataFlavor[] availableFlavors)     * @param transferable The <code>Transferable</code> for which a text
853  {     *                     <code>Reader</code> is requested.
854    for(int i=0; i<availableFlavors.length; i++)     *
855      {     * @exception IllegalArgumentException If the representation class is not one
856        DataFlavor df = availableFlavors[i];     * of the seven listed above or the Transferable has null data.
857        Class c = df.representationClass;     * @exception NullPointerException If the Transferable is null.
858       * @exception UnsupportedFlavorException when the transferable doesn't
859        // A Reader or String is good.     * support this <code>DataFlavor</code>. Or if the representable class
860        if ((Reader.class.isAssignableFrom(c))     * isn't a (subclass of) <code>Reader</code>, <code>String</code>,
861            || (String.class.isAssignableFrom(c)))     * <code>InputStream</code> and/or the primary MIME type isn't "text".
862          {     * @exception IOException when any IOException occurs.
863            return df;     * @exception UnsupportedEncodingException if the "charset" isn't supported
864          }     * on this platform.
865       */
866        // A InputStream is good if the mime primary type is "text"    public Reader getReaderForText(Transferable transferable)
867        if ((InputStream.class.isAssignableFrom(c))      throws UnsupportedFlavorException, IOException
868            && ("text".equals(df.getPrimaryType())))    {
869          if (!transferable.isDataFlavorSupported(this))
870              throw new UnsupportedFlavorException(this);
871      
872          if (Reader.class.isAssignableFrom(representationClass))
873              return (Reader)transferable.getTransferData(this);
874      
875          if (String.class.isAssignableFrom(representationClass))
876              return new StringReader((String)transferable.getTransferData(this));
877      
878          if (InputStream.class.isAssignableFrom(representationClass)
879              && "text".equals(getPrimaryType()))
880          {          {
881            String encoding = availableFlavors[i].getParameter("charset");            InputStream in = (InputStream)transferable.getTransferData(this);
882              String encoding = getParameter("charset");
883            if (encoding == null)            if (encoding == null)
884              encoding = "us-ascii";                encoding = "us-ascii";
885            Reader r = null;            return new InputStreamReader(in, encoding);
           try  
             {  
               // Try to construct a dummy reader with the found encoding  
               r = new InputStreamReader  
                     (new ByteArrayInputStream(new byte[0]), encoding);  
             }  
           catch(UnsupportedEncodingException uee) { /* ignore */ }  
           if (r != null)  
             return df;  
886          }          }
887      }    
888          throw new UnsupportedFlavorException(this);
889    // Nothing found    }
   return(null);  
 }  
   
 /*************************************************************************/  
   
 /**  
  * Creates a <code>Reader</code> for a given <code>Transferable</code>.  
  *  
  * If the representation class is a (subclass of) <code>Reader</code>  
  * then an instance of the representation class is returned. If the  
  * representatation class is a <code>String</code> then a  
  * <code>StringReader</code> is returned. And if the representation class  
  * is a (subclass of) <code>InputStream</code> and the primary MIME type  
  * is "text" then a <code>InputStreamReader</code> for the correct charset  
  * encoding is returned.  
  *  
  * @param transferable The <code>Transferable</code> for which a text  
  *                     <code>Reader</code> is requested.  
  *  
  * @exception IllegalArgumentException If the representation class is not one  
  * of the seven listed above or the Transferable has null data.  
  * @exception NullPointerException If the Transferable is null.  
  * @exception UnsupportedFlavorException when the transferable doesn't  
  * support this <code>DataFlavor</code>. Or if the representable class  
  * isn't a (subclass of) <code>Reader</code>, <code>String</code>,  
  * <code>InputStream</code> and/or the primary MIME type isn't "text".  
  * @exception IOException when any IOException occurs.  
  * @exception UnsupportedEncodingException if the "charset" isn't supported  
  * on this platform.  
  */  
 public Reader getReaderForText(Transferable transferable)  
   throws UnsupportedFlavorException, IOException  
 {  
     if (!transferable.isDataFlavorSupported(this))  
         throw new UnsupportedFlavorException(this);  
   
     if (Reader.class.isAssignableFrom(representationClass))  
         return((Reader)transferable.getTransferData(this));  
   
     if (String.class.isAssignableFrom(representationClass))  
         return(new StringReader((String)transferable.getTransferData(this)));  
   
     if (InputStream.class.isAssignableFrom(representationClass)  
         && "text".equals(getPrimaryType()))  
       {  
         InputStream in = (InputStream)transferable.getTransferData(this);  
         String encoding = getParameter("charset");  
         if (encoding == null)  
             encoding = "us-ascii";  
         return(new InputStreamReader(in, encoding));  
       }  
   
     throw new UnsupportedFlavorException(this);  
 }  
890    
891    /**    /**
892     * Returns whether the representation class for this DataFlavor is     * Returns whether the representation class for this DataFlavor is
# Line 1010  public Reader getReaderForText(Transfera Line 894  public Reader getReaderForText(Transfera
894     *     *
895     * @since 1.4     * @since 1.4
896     */     */
897    public boolean isRepresentationClassByteBuffer ()    public boolean isRepresentationClassByteBuffer()
898    {    {
899      return ByteBuffer.class.isAssignableFrom (representationClass);      return ByteBuffer.class.isAssignableFrom(representationClass);
900    }    }
901    
902    /**    /**
# Line 1021  public Reader getReaderForText(Transfera Line 905  public Reader getReaderForText(Transfera
905     *     *
906     * @since 1.4     * @since 1.4
907     */     */
908    public boolean isRepresentationClassCharBuffer ()    public boolean isRepresentationClassCharBuffer()
909    {    {
910      return CharBuffer.class.isAssignableFrom (representationClass);      return CharBuffer.class.isAssignableFrom(representationClass);
911    }    }
912    
913    /**    /**
# Line 1032  public Reader getReaderForText(Transfera Line 916  public Reader getReaderForText(Transfera
916     *     *
917     * @since 1.4     * @since 1.4
918     */     */
919    public boolean isRepresentationClassReader ()    public boolean isRepresentationClassReader()
920    {    {
921      return Reader.class.isAssignableFrom (representationClass);      return Reader.class.isAssignableFrom(representationClass);
922    }    }
   
923  } // class DataFlavor  } // class DataFlavor
924    

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26