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

Print this page




2881                         return comp;
2882                     }
2883 
2884                     // Next, compare charsets
2885                     comp = charsetComparator.compareCharsets
2886                         (DataTransferer.getTextCharset(flavor1),
2887                          DataTransferer.getTextCharset(flavor2));
2888                     if (comp != 0) {
2889                         return comp;
2890                     }
2891                 }
2892 
2893                 // Finally, prefer the encoded text representations of
2894                 // InputStream, ByteBuffer, and [B, in that order.
2895                 comp = compareIndices(encodedTextRepresentations, class1,
2896                                       class2, UNKNOWN_OBJECT_LOSES);
2897                 if (comp != 0) {
2898                     return comp;
2899                 }
2900             } else {
2901                 // First, prefer application types.
2902                 comp = compareIndices(primaryTypes, primaryType1, primaryType2,
2903                                       UNKNOWN_OBJECT_LOSES);
2904                 if (comp != 0) {
2905                     return comp;
2906                 }
2907 
2908                 if (flavor1.isFlavorTextType()) {
2909                     return 1;
2910                 }
2911 
2912                 if (flavor2.isFlavorTextType()) {
2913                     return -1;







2914                 }
2915 
2916                 // Next, look for application/x-java-* types. Prefer unknown
2917                 // MIME types because if the user provides his own data flavor,
2918                 // it will likely be the most descriptive one.
2919                 comp = compareIndices(exactTypes, mimeType1, mimeType2,
2920                                       UNKNOWN_OBJECT_WINS);
2921                 if (comp != 0) {
2922                     return comp;
2923                 }
2924 
2925                 // Finally, prefer the representation classes of Remote,
2926                 // Serializable, and InputStream, in that order.
2927                 comp = compareIndices(nonTextRepresentations, class1, class2,
2928                                       UNKNOWN_OBJECT_LOSES);
2929                 if (comp != 0) {
2930                     return comp;
2931                 }
2932             }
2933 




2881                         return comp;
2882                     }
2883 
2884                     // Next, compare charsets
2885                     comp = charsetComparator.compareCharsets
2886                         (DataTransferer.getTextCharset(flavor1),
2887                          DataTransferer.getTextCharset(flavor2));
2888                     if (comp != 0) {
2889                         return comp;
2890                     }
2891                 }
2892 
2893                 // Finally, prefer the encoded text representations of
2894                 // InputStream, ByteBuffer, and [B, in that order.
2895                 comp = compareIndices(encodedTextRepresentations, class1,
2896                                       class2, UNKNOWN_OBJECT_LOSES);
2897                 if (comp != 0) {
2898                     return comp;
2899                 }
2900             } else {
2901                 // First, prefer text types






2902                 if (flavor1.isFlavorTextType()) {
2903                     return 1;
2904                 }
2905 
2906                 if (flavor2.isFlavorTextType()) {
2907                     return -1;
2908                 }
2909 
2910                 // Next, prefer application types.
2911                 comp = compareIndices(primaryTypes, primaryType1, primaryType2,
2912                         UNKNOWN_OBJECT_LOSES);
2913                 if (comp != 0) {
2914                     return comp;
2915                 }
2916 
2917                 // Next, look for application/x-java-* types. Prefer unknown
2918                 // MIME types because if the user provides his own data flavor,
2919                 // it will likely be the most descriptive one.
2920                 comp = compareIndices(exactTypes, mimeType1, mimeType2,
2921                                       UNKNOWN_OBJECT_WINS);
2922                 if (comp != 0) {
2923                     return comp;
2924                 }
2925 
2926                 // Finally, prefer the representation classes of Remote,
2927                 // Serializable, and InputStream, in that order.
2928                 comp = compareIndices(nonTextRepresentations, class1, class2,
2929                                       UNKNOWN_OBJECT_LOSES);
2930                 if (comp != 0) {
2931                     return comp;
2932                 }
2933             }
2934