java类java.awt.datatransfer.FlavorTable的实例源码

DataTransferer.java 文件源码 项目:openjdk-jdk10 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is {@code null}
 */
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set<DataFlavor> flavorSet = new HashSet<>(formats.length);

    for (long format : formats) {
        List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
        for (DataFlavor flavor : flavors) {
            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                    flavor.isFlavorJavaFileListType() ||
                    DataFlavor.imageFlavor.equals(flavor) ||
                    flavor.isRepresentationClassSerializable() ||
                    flavor.isRepresentationClassInputStream() ||
                    flavor.isRepresentationClassRemote()) {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
DataTransferer.java 文件源码 项目:openjdk9 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is {@code null}
 */
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set<DataFlavor> flavorSet = new HashSet<>(formats.length);

    for (long format : formats) {
        List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
        for (DataFlavor flavor : flavors) {
            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                    flavor.isFlavorJavaFileListType() ||
                    DataFlavor.imageFlavor.equals(flavor) ||
                    flavor.isRepresentationClassSerializable() ||
                    flavor.isRepresentationClassInputStream() ||
                    flavor.isRepresentationClassRemote()) {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
DataTransferer.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
DataTransferer.java 文件源码 项目:OpenJSharp 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
WDataTransferer.java 文件源码 项目:OpenJSharp 阅读 21 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
IkvmDataTransferer.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
    SortedMap retval = super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataTransferer.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
DataTransferer.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
WDataTransferer.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
DataTransferer.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
                                                            FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return Collections.emptySortedMap();
    }
    return getFormatsForFlavors(flavors, map);
}
WDataTransferer.java 文件源码 项目:openjdk-jdk10 阅读 28 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
DataTransferer.java 文件源码 项目:openjdk9 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
                                                            FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return Collections.emptySortedMap();
    }
    return getFormatsForFlavors(flavors, map);
}
WDataTransferer.java 文件源码 项目:openjdk9 阅读 29 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:openjdk9 阅读 20 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
WDataTransferer.java 文件源码 项目:jdk8u_jdk 阅读 32 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:jdk8u_jdk 阅读 27 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
DataTransferer.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
DataTransferer.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
WDataTransferer.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 25 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 27 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
DataTransferer.java 文件源码 项目:infobip-open-jdk-8 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
DataTransferer.java 文件源码 项目:infobip-open-jdk-8 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
WDataTransferer.java 文件源码 项目:infobip-open-jdk-8 阅读 29 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:infobip-open-jdk-8 阅读 21 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
DataTransferer.java 文件源码 项目:jdk8u-dev-jdk 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
DataTransferer.java 文件源码 项目:jdk8u-dev-jdk 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
WDataTransferer.java 文件源码 项目:jdk8u-dev-jdk 阅读 34 收藏 0 点赞 0 评论 0
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
DataFlavorSearcher.java 文件源码 项目:jdk8u-dev-jdk 阅读 21 收藏 0 点赞 0 评论 0
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}


问题


面经


文章

微信
公众号

扫码关注公众号