Java Code Examples for sun.awt.datatransfer.DataTransferer#doesSubtypeSupportCharset()
The following examples show how to use
sun.awt.datatransfer.DataTransferer#doesSubtypeSupportCharset() .
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: XDataTransferer.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 2
Source File: XDataTransferer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 3
Source File: XDataTransferer.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 4
Source File: XDataTransferer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 5
Source File: XDataTransferer.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 6
Source File: XDataTransferer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
protected String getCharsetForTextFormat(Long lFormat) { long format = lFormat.longValue(); if (isMimeFormat(format, "text")) { String nat = getNativeForFormat(format); DataFlavor df = new DataFlavor(nat, null); // Ignore the charset parameter of the MIME type if the subtype // doesn't support charset. if (!DataTransferer.doesSubtypeSupportCharset(df)) { return null; } String charset = df.getParameter("charset"); if (charset != null) { return charset; } } return super.getCharsetForTextFormat(lFormat); }
Example 7
Source File: DataFlavor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns hash code for this <code>DataFlavor</code>. * For two equal <code>DataFlavor</code>s, hash codes are equal. * For the <code>String</code> * that matches <code>DataFlavor.equals(String)</code>, it is not * guaranteed that <code>DataFlavor</code>'s hash code is equal * to the hash code of the <code>String</code>. * * @return a hash code for this <code>DataFlavor</code> */ public int hashCode() { int total = 0; if (representationClass != null) { total += representationClass.hashCode(); } if (mimeType != null) { String primaryType = mimeType.getPrimaryType(); if (primaryType != null) { total += primaryType.hashCode(); } // Do not add subType.hashCode() to the total. equals uses // MimeType.match which reports a match if one or both of the // subTypes is '*', regardless of the other subType. if ("text".equals(primaryType)) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String charset = DataTransferer.canonicalName(getParameter("charset")); if (charset != null) { total += charset.hashCode(); } } if ("html".equals(getSubType())) { String document = this.getParameter("document"); if (document != null) { total += document.hashCode(); } } } } return total; }
Example 8
Source File: DataFlavor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns hash code for this <code>DataFlavor</code>. * For two equal <code>DataFlavor</code>s, hash codes are equal. * For the <code>String</code> * that matches <code>DataFlavor.equals(String)</code>, it is not * guaranteed that <code>DataFlavor</code>'s hash code is equal * to the hash code of the <code>String</code>. * * @return a hash code for this <code>DataFlavor</code> */ public int hashCode() { int total = 0; if (representationClass != null) { total += representationClass.hashCode(); } if (mimeType != null) { String primaryType = mimeType.getPrimaryType(); if (primaryType != null) { total += primaryType.hashCode(); } // Do not add subType.hashCode() to the total. equals uses // MimeType.match which reports a match if one or both of the // subTypes is '*', regardless of the other subType. if ("text".equals(primaryType)) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String charset = DataTransferer.canonicalName(getParameter("charset")); if (charset != null) { total += charset.hashCode(); } } if ("html".equals(getSubType())) { String document = this.getParameter("document"); if (document != null) { total += document.hashCode(); } } } } return total; }
Example 9
Source File: DataFlavor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns hash code for this <code>DataFlavor</code>. * For two equal <code>DataFlavor</code>s, hash codes are equal. * For the <code>String</code> * that matches <code>DataFlavor.equals(String)</code>, it is not * guaranteed that <code>DataFlavor</code>'s hash code is equal * to the hash code of the <code>String</code>. * * @return a hash code for this <code>DataFlavor</code> */ public int hashCode() { int total = 0; if (representationClass != null) { total += representationClass.hashCode(); } if (mimeType != null) { String primaryType = mimeType.getPrimaryType(); if (primaryType != null) { total += primaryType.hashCode(); } // Do not add subType.hashCode() to the total. equals uses // MimeType.match which reports a match if one or both of the // subTypes is '*', regardless of the other subType. if ("text".equals(primaryType)) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String charset = DataTransferer.canonicalName(getParameter("charset")); if (charset != null) { total += charset.hashCode(); } } if ("html".equals(getSubType())) { String document = this.getParameter("document"); if (document != null) { total += document.hashCode(); } } } } return total; }
Example 10
Source File: DataFlavor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns hash code for this <code>DataFlavor</code>. * For two equal <code>DataFlavor</code>s, hash codes are equal. * For the <code>String</code> * that matches <code>DataFlavor.equals(String)</code>, it is not * guaranteed that <code>DataFlavor</code>'s hash code is equal * to the hash code of the <code>String</code>. * * @return a hash code for this <code>DataFlavor</code> */ public int hashCode() { int total = 0; if (representationClass != null) { total += representationClass.hashCode(); } if (mimeType != null) { String primaryType = mimeType.getPrimaryType(); if (primaryType != null) { total += primaryType.hashCode(); } // Do not add subType.hashCode() to the total. equals uses // MimeType.match which reports a match if one or both of the // subTypes is '*', regardless of the other subType. if ("text".equals(primaryType)) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String charset = DataTransferer.canonicalName(getParameter("charset")); if (charset != null) { total += charset.hashCode(); } } if ("html".equals(getSubType())) { String document = this.getParameter("document"); if (document != null) { total += document.hashCode(); } } } } return total; }
Example 11
Source File: DataFlavor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns hash code for this <code>DataFlavor</code>. * For two equal <code>DataFlavor</code>s, hash codes are equal. * For the <code>String</code> * that matches <code>DataFlavor.equals(String)</code>, it is not * guaranteed that <code>DataFlavor</code>'s hash code is equal * to the hash code of the <code>String</code>. * * @return a hash code for this <code>DataFlavor</code> */ public int hashCode() { int total = 0; if (representationClass != null) { total += representationClass.hashCode(); } if (mimeType != null) { String primaryType = mimeType.getPrimaryType(); if (primaryType != null) { total += primaryType.hashCode(); } // Do not add subType.hashCode() to the total. equals uses // MimeType.match which reports a match if one or both of the // subTypes is '*', regardless of the other subType. if ("text".equals(primaryType)) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String charset = DataTransferer.canonicalName(getParameter("charset")); if (charset != null) { total += charset.hashCode(); } } if ("html".equals(getSubType())) { String document = this.getParameter("document"); if (document != null) { total += document.hashCode(); } } } } return total; }
Example 12
Source File: DataFlavor.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 13
Source File: DataFlavor.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 14
Source File: DataFlavor.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (representationClass == null) { if (that.getRepresentationClass() != null) { return false; } } else { if (!representationClass.equals(that.getRepresentationClass())) { return false; } } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !(isRepresentationClassReader() || String.class.equals(representationClass) || isRepresentationClassCharBuffer() || DataTransferer.charArrayClass.equals(representationClass))) { String thisCharset = DataTransferer.canonicalName(getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (thisCharset == null) { if (thatCharset != null) { return false; } } else { if (!thisCharset.equals(thatCharset)) { return false; } } } if ("html".equals(getSubType()) && this.getParameter("document") != null ) { if (!this.getParameter("document"). equals(that.getParameter("document"))) { return false; } } } } return true; }
Example 15
Source File: DataFlavor.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 16
Source File: DataFlavor.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 17
Source File: DataFlavor.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (representationClass == null) { if (that.getRepresentationClass() != null) { return false; } } else { if (!representationClass.equals(that.getRepresentationClass())) { return false; } } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !(isRepresentationClassReader() || String.class.equals(representationClass) || isRepresentationClassCharBuffer() || DataTransferer.charArrayClass.equals(representationClass))) { String thisCharset = DataTransferer.canonicalName(getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (thisCharset == null) { if (thatCharset != null) { return false; } } else { if (!thisCharset.equals(thatCharset)) { return false; } } } if ("html".equals(getSubType()) && this.getParameter("document") != null ) { if (!this.getParameter("document"). equals(that.getParameter("document"))) { return false; } } } } return true; }
Example 18
Source File: DataFlavor.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 19
Source File: DataFlavor.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }
Example 20
Source File: DataFlavor.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * This method has the same behavior as {@link #equals(Object)}. * The only difference being that it takes a {@code DataFlavor} instance * as a parameter. * * @param that the <code>DataFlavor</code> to compare with * <code>this</code> * @return <code>true</code> if <code>that</code> is equivalent to this * <code>DataFlavor</code>; <code>false</code> otherwise * @see #selectBestTextFlavor */ public boolean equals(DataFlavor that) { if (that == null) { return false; } if (this == that) { return true; } if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) { return false; } if (mimeType == null) { if (that.mimeType != null) { return false; } } else { if (!mimeType.match(that.mimeType)) { return false; } if ("text".equals(getPrimaryType())) { if (DataTransferer.doesSubtypeSupportCharset(this) && representationClass != null && !isStandardTextRepresentationClass()) { String thisCharset = DataTransferer.canonicalName(this.getParameter("charset")); String thatCharset = DataTransferer.canonicalName(that.getParameter("charset")); if (!Objects.equals(thisCharset, thatCharset)) { return false; } } if ("html".equals(getSubType())) { String thisDocument = this.getParameter("document"); String thatDocument = that.getParameter("document"); if (!Objects.equals(thisDocument, thatDocument)) { return false; } } } } return true; }