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

The following examples show how to use sun.awt.datatransfer.DataTransferer#isFlavorCharsetTextType() . 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: DataFlavor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 2
Source File: DataFlavor.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 3
Source File: DataFlavor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 4
Source File: DataFlavor.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 5
Source File: DataFlavor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 6
Source File: DataFlavor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 7
Source File: DataFlavor.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 8
Source File: DataFlavor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
 
Example 9
Source File: XDataTransferer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public List getPlatformMappingsForFlavor(DataFlavor df) {
    List natives = new ArrayList(1);

    if (df == null) {
        return natives;
    }

    String charset = df.getParameter("charset");
    String baseType = df.getPrimaryType() + "/" + df.getSubType();
    String mimeType = baseType;

    if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) {
        mimeType += ";charset=" + charset;
    }

    // Add a mapping to the MIME native whenever the representation class
    // doesn't require translation.
    if (df.getRepresentationClass() != null &&
        (df.isRepresentationClassInputStream() ||
         df.isRepresentationClassByteBuffer() ||
         byteArrayClass.equals(df.getRepresentationClass()))) {
        natives.add(mimeType);
    }

    if (DataFlavor.imageFlavor.equals(df)) {
        String[] mimeTypes = ImageIO.getWriterMIMETypes();
        if (mimeTypes != null) {
            for (int i = 0; i < mimeTypes.length; i++) {
                Iterator writers =
                    ImageIO.getImageWritersByMIMEType(mimeTypes[i]);

                while (writers.hasNext()) {
                    ImageWriter imageWriter = (ImageWriter)writers.next();
                    ImageWriterSpi writerSpi =
                        imageWriter.getOriginatingProvider();

                    if (writerSpi != null &&
                        writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
                        natives.add(mimeTypes[i]);
                        break;
                    }
                }
            }
        }
    } else if (DataTransferer.isFlavorCharsetTextType(df)) {
        // stringFlavor is semantically equivalent to the standard
        // "text/plain" MIME type.
        if (DataFlavor.stringFlavor.equals(df)) {
            baseType = "text/plain";
        }

        for (String encoding : DataTransferer.standardEncodings()) {
            if (!encoding.equals(charset)) {
                natives.add(baseType + ";charset=" + encoding);
            }
        }

        // Add a MIME format without specified charset.
        if (!natives.contains(baseType)) {
            natives.add(baseType);
        }
    }

    return natives;
}
 
Example 10
Source File: XDataTransferer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
    LinkedHashSet<String> natives = new LinkedHashSet<>(1);

    if (df == null) {
        return natives;
    }

    String charset = df.getParameter("charset");
    String baseType = df.getPrimaryType() + "/" + df.getSubType();
    String mimeType = baseType;

    if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) {
        mimeType += ";charset=" + charset;
    }

    // Add a mapping to the MIME native whenever the representation class
    // doesn't require translation.
    if (df.getRepresentationClass() != null &&
        (df.isRepresentationClassInputStream() ||
         df.isRepresentationClassByteBuffer() ||
         byte[].class.equals(df.getRepresentationClass()))) {
        natives.add(mimeType);
    }

    if (DataFlavor.imageFlavor.equals(df)) {
        String[] mimeTypes = ImageIO.getWriterMIMETypes();
        if (mimeTypes != null) {
            for (int i = 0; i < mimeTypes.length; i++) {
                Iterator writers =
                    ImageIO.getImageWritersByMIMEType(mimeTypes[i]);

                while (writers.hasNext()) {
                    ImageWriter imageWriter = (ImageWriter)writers.next();
                    ImageWriterSpi writerSpi =
                        imageWriter.getOriginatingProvider();

                    if (writerSpi != null &&
                        writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
                        natives.add(mimeTypes[i]);
                        break;
                    }
                }
            }
        }
    } else if (DataTransferer.isFlavorCharsetTextType(df)) {
        // stringFlavor is semantically equivalent to the standard
        // "text/plain" MIME type.
        if (DataFlavor.stringFlavor.equals(df)) {
            baseType = "text/plain";
        }

        for (String encoding : DataTransferer.standardEncodings()) {
            if (!encoding.equals(charset)) {
                natives.add(baseType + ";charset=" + encoding);
            }
        }

        // Add a MIME format without specified charset.
        if (!natives.contains(baseType)) {
            natives.add(baseType);
        }
    }

    return natives;
}
 
Example 11
Source File: XDataTransferer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
    LinkedHashSet<String> natives = new LinkedHashSet<>(1);

    if (df == null) {
        return natives;
    }

    String charset = df.getParameter("charset");
    String baseType = df.getPrimaryType() + "/" + df.getSubType();
    String mimeType = baseType;

    if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) {
        mimeType += ";charset=" + charset;
    }

    // Add a mapping to the MIME native whenever the representation class
    // doesn't require translation.
    if (df.getRepresentationClass() != null &&
        (df.isRepresentationClassInputStream() ||
         df.isRepresentationClassByteBuffer() ||
         byte[].class.equals(df.getRepresentationClass()))) {
        natives.add(mimeType);
    }

    if (DataFlavor.imageFlavor.equals(df)) {
        String[] mimeTypes = ImageIO.getWriterMIMETypes();
        if (mimeTypes != null) {
            for (int i = 0; i < mimeTypes.length; i++) {
                Iterator writers =
                    ImageIO.getImageWritersByMIMEType(mimeTypes[i]);

                while (writers.hasNext()) {
                    ImageWriter imageWriter = (ImageWriter)writers.next();
                    ImageWriterSpi writerSpi =
                        imageWriter.getOriginatingProvider();

                    if (writerSpi != null &&
                        writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
                        natives.add(mimeTypes[i]);
                        break;
                    }
                }
            }
        }
    } else if (DataTransferer.isFlavorCharsetTextType(df)) {
        // stringFlavor is semantically equivalent to the standard
        // "text/plain" MIME type.
        if (DataFlavor.stringFlavor.equals(df)) {
            baseType = "text/plain";
        }

        for (String encoding : DataTransferer.standardEncodings()) {
            if (!encoding.equals(charset)) {
                natives.add(baseType + ";charset=" + encoding);
            }
        }

        // Add a MIME format without specified charset.
        if (!natives.contains(baseType)) {
            natives.add(baseType);
        }
    }

    return natives;
}
 
Example 12
Source File: XDataTransferer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
    LinkedHashSet<String> natives = new LinkedHashSet<>(1);

    if (df == null) {
        return natives;
    }

    String charset = df.getParameter("charset");
    String baseType = df.getPrimaryType() + "/" + df.getSubType();
    String mimeType = baseType;

    if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) {
        mimeType += ";charset=" + charset;
    }

    // Add a mapping to the MIME native whenever the representation class
    // doesn't require translation.
    if (df.getRepresentationClass() != null &&
        (df.isRepresentationClassInputStream() ||
         df.isRepresentationClassByteBuffer() ||
         byte[].class.equals(df.getRepresentationClass()))) {
        natives.add(mimeType);
    }

    if (DataFlavor.imageFlavor.equals(df)) {
        String[] mimeTypes = ImageIO.getWriterMIMETypes();
        if (mimeTypes != null) {
            for (int i = 0; i < mimeTypes.length; i++) {
                Iterator writers =
                    ImageIO.getImageWritersByMIMEType(mimeTypes[i]);

                while (writers.hasNext()) {
                    ImageWriter imageWriter = (ImageWriter)writers.next();
                    ImageWriterSpi writerSpi =
                        imageWriter.getOriginatingProvider();

                    if (writerSpi != null &&
                        writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
                        natives.add(mimeTypes[i]);
                        break;
                    }
                }
            }
        }
    } else if (DataTransferer.isFlavorCharsetTextType(df)) {
        // stringFlavor is semantically equivalent to the standard
        // "text/plain" MIME type.
        if (DataFlavor.stringFlavor.equals(df)) {
            baseType = "text/plain";
        }

        for (String encoding : DataTransferer.standardEncodings()) {
            if (!encoding.equals(charset)) {
                natives.add(baseType + ";charset=" + encoding);
            }
        }

        // Add a MIME format without specified charset.
        if (!natives.contains(baseType)) {
            natives.add(baseType);
        }
    }

    return natives;
}
 
Example 13
Source File: XDataTransferer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
    LinkedHashSet<String> natives = new LinkedHashSet<>(1);

    if (df == null) {
        return natives;
    }

    String charset = df.getParameter("charset");
    String baseType = df.getPrimaryType() + "/" + df.getSubType();
    String mimeType = baseType;

    if (charset != null && DataTransferer.isFlavorCharsetTextType(df)) {
        mimeType += ";charset=" + charset;
    }

    // Add a mapping to the MIME native whenever the representation class
    // doesn't require translation.
    if (df.getRepresentationClass() != null &&
        (df.isRepresentationClassInputStream() ||
         df.isRepresentationClassByteBuffer() ||
         byte[].class.equals(df.getRepresentationClass()))) {
        natives.add(mimeType);
    }

    if (DataFlavor.imageFlavor.equals(df)) {
        String[] mimeTypes = ImageIO.getWriterMIMETypes();
        if (mimeTypes != null) {
            for (int i = 0; i < mimeTypes.length; i++) {
                Iterator writers =
                    ImageIO.getImageWritersByMIMEType(mimeTypes[i]);

                while (writers.hasNext()) {
                    ImageWriter imageWriter = (ImageWriter)writers.next();
                    ImageWriterSpi writerSpi =
                        imageWriter.getOriginatingProvider();

                    if (writerSpi != null &&
                        writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
                        natives.add(mimeTypes[i]);
                        break;
                    }
                }
            }
        }
    } else if (DataTransferer.isFlavorCharsetTextType(df)) {
        // stringFlavor is semantically equivalent to the standard
        // "text/plain" MIME type.
        if (DataFlavor.stringFlavor.equals(df)) {
            baseType = "text/plain";
        }

        for (String encoding : DataTransferer.standardEncodings()) {
            if (!encoding.equals(charset)) {
                natives.add(baseType + ";charset=" + encoding);
            }
        }

        // Add a MIME format without specified charset.
        if (!natives.contains(baseType)) {
            natives.add(baseType);
        }
    }

    return natives;
}
 
Example 14
Source File: DataFlavor.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 15
Source File: DataFlavor.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 16
Source File: DataFlavor.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 17
Source File: DataFlavor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 18
Source File: DataFlavor.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 19
Source File: DataFlavor.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}
 
Example 20
Source File: DataFlavor.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns whether this <code>DataFlavor</code> is a valid text flavor for
 * this implementation of the Java platform. Only flavors equivalent to
 * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
 * a primary MIME type of "text" can be valid text flavors.
 * <p>
 * If this flavor supports the charset parameter, it must be equivalent to
 * <code>DataFlavor.stringFlavor</code>, or its representation must be
 * <code>java.io.Reader</code>, <code>java.lang.String</code>,
 * <code>java.nio.CharBuffer</code>, <code>[C</code>,
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>. If the representation is
 * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
 * <code>[B</code>, then this flavor's <code>charset</code> parameter must
 * be supported by this implementation of the Java platform. If a charset
 * is not specified, then the platform default charset, which is always
 * supported, is assumed.
 * <p>
 * If this flavor does not support the charset parameter, its
 * representation must be <code>java.io.InputStream</code>,
 * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
 * <p>
 * See <code>selectBestTextFlavor</code> for a list of text flavors which
 * support the charset parameter.
 *
 * @return <code>true</code> if this <code>DataFlavor</code> is a valid
 *         text flavor as described above; <code>false</code> otherwise
 * @see #selectBestTextFlavor
 * @since 1.4
 */
public boolean isFlavorTextType() {
    return (DataTransferer.isFlavorCharsetTextType(this) ||
            DataTransferer.isFlavorNoncharsetTextType(this));
}