javax.mail.internet.MimeBodyPart.isMimeType()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(15.8k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中javax.mail.internet.MimeBodyPart.isMimeType()方法的一些代码示例,展示了MimeBodyPart.isMimeType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.isMimeType()方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称:MimeBodyPart
方法名:isMimeType

MimeBodyPart.isMimeType介绍

[英]Is this Part of the specified MIME type? This method compares only the primaryType and subType. The parameters of the content types are ignored.

For example, this method will return true when comparing a Part of content type "text/plain" with "text/plain; charset=foobar".

If the subType of mimeType is the special character '', then the subtype is ignored during the comparison.
[中]这是指定MIME类型的一部分吗?此方法仅比较primaryTypesubType。内容类型的参数将被忽略。
例如,当比较内容类型“text/plain”与“text/plain;charset=foobar”的一部分时,此方法将返回true
如果mimeTypesubType是特殊字符“
”,则在比较过程中忽略子类型。

代码示例

代码示例来源:origin: stackoverflow.com

System.out.println( "HTML = text/html : " + htmlPart.isMimeType( "text/html" ) );
System.out.println( "HTML Content Type: " + htmlPart.getContentType() );
System.out.println( "TEXT = text/plain: " + textPart.isMimeType( "text/plain" ) );
System.out.println( "HTML = text/html : " + htmlPart.isMimeType( "text/html" ) );
System.out.println( "HTML Content Type: " + htmlPart.getContentType() );
System.out.println( "HTML Data Handler: " + htmlPart.getDataHandler().getContentType() );

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @param    mimeType    the MIME type to check
 * @return            true if it matches the MIME type
 * @exception        MessagingException for failures
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @param    mimeType    the MIME type to check
 * @return            true if it matches the MIME type
 * @exception        MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 */
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: javax.mail/javax.mail-api

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: jboss/jboss-javaee-specs

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: org.glassfish.metro/webservices-extra

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/mailapi

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @exception    MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @param    mimeType    the MIME type to check
 * @return            true if it matches the MIME type
 * @exception        MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: javax.mail/javax.mail-api

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @param    mimeType    the MIME type to check
 * @return            true if it matches the MIME type
 * @exception        MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Is this Part of the specified MIME type?  This method
 * compares <strong>only the <code>primaryType</code> and 
 * <code>subType</code></strong>.
 * The parameters of the content types are ignored. <p>
 *
 * For example, this method will return <code>true</code> when
 * comparing a Part of content type <strong>"text/plain"</strong>
 * with <strong>"text/plain; charset=foobar"</strong>. <p>
 *
 * If the <code>subType</code> of <code>mimeType</code> is the
 * special character '*', then the subtype is ignored during the
 * comparison.
 *
 * @param    mimeType    the MIME type to check
 * @return            true if it matches the MIME type
 * @exception        MessagingException for failures
 */
@Override
public boolean isMimeType(String mimeType) throws MessagingException {
return MimeBodyPart.isMimeType(this, mimeType);
}

代码示例来源:origin: stackoverflow.com

MimeBodyPart mbp = (MimeBodyPart)part;
if (mbp.isMimeType("text/plain")) {
  body += mbp.getContent().toString();
} else if (mbp.isMimeType("TEXT/HTML")) {
  body += mbp.getContent().toString(); 
}else if(mbp.isMimeType("text/xml")) {
  body += mbp.getContent().toString(); 
}

代码示例来源:origin: stackoverflow.com

if( mimeMessage.getContent() instanceof Multipart) {
     Multipart multipartContent = (Multipart) mimeMessage.getContent();
     List<BodyPart> deleteThese = new ArrayList<BodyPart>();
     for( int i = 0; i < multipartContent.getCount(); i++ ) {
       MimeBodyPart part = (MimeBodyPart) multipartContent.getBodyPart(i);
       String disposition = part.getDisposition();
       if( disposition != null
           && ( disposition.equalsIgnoreCase( Part.ATTACHMENT )
           || ( disposition.equalsIgnoreCase( Part.INLINE )
              && !part.isMimeType( PLAIN_TEXT_MIME_TYPE )
              && !part.isMimeType( HTML_MIME_TYPE ) )
       ) ) {
         // do something with part
       }
     }

相关文章