Java Code Examples for sun.awt.datatransfer.DataTransferer#getPlatformMappingsForNative()

The following examples show how to use sun.awt.datatransfer.DataTransferer#getPlatformMappingsForNative() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemFlavorMap.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 2
Source File: SystemFlavorMap.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 3
Source File: SystemFlavorMap.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 4
Source File: SystemFlavorMap.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 5
Source File: SystemFlavorMap.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 6
Source File: SystemFlavorMap.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 7
Source File: SystemFlavorMap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 8
Source File: SystemFlavorMap.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 9
Source File: SystemFlavorMap.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 10
Source File: SystemFlavorMap.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 11
Source File: SystemFlavorMap.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private List<DataFlavor> nativeToFlavorLookup(String nat) {
    List<DataFlavor> flavors = getNativeToFlavor().get(nat);

    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            List<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    platformFlavors.removeAll(new HashSet<>(flavors));
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new ArrayList<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            getFlavorsForNativeCache.remove(nat);
            getFlavorsForNativeCache.remove(null);

            List<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new ArrayList<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            getNativesForFlavorCache.remove(flavor);
            getNativesForFlavorCache.remove(null);
        }
    }

    return (flavors != null) ? flavors : new ArrayList<>(0);
}
 
Example 12
Source File: SystemFlavorMap.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private List<DataFlavor> nativeToFlavorLookup(String nat) {
    List<DataFlavor> flavors = getNativeToFlavor().get(nat);

    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            List<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    platformFlavors.removeAll(new HashSet<>(flavors));
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new ArrayList<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            getFlavorsForNativeCache.remove(nat);
            getFlavorsForNativeCache.remove(null);

            List<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new ArrayList<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            getNativesForFlavorCache.remove(flavor);
            getNativesForFlavorCache.remove(null);
        }
    }

    return (flavors != null) ? flavors : new ArrayList<>(0);
}
 
Example 13
Source File: SystemFlavorMap.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 14
Source File: SystemFlavorMap.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
Example 15
Source File: SystemFlavorMap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}