当前位置: 首页>>代码示例>>Java>>正文


Java MimeType类代码示例

本文整理汇总了Java中com.helger.commons.mime.MimeType的典型用法代码示例。如果您正苦于以下问题:Java MimeType类的具体用法?Java MimeType怎么用?Java MimeType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MimeType类属于com.helger.commons.mime包,在下文中一共展示了MimeType类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _generatePModePayloadProfile

import com.helger.commons.mime.MimeType; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
private ICommonsOrderedMap <String, PModePayloadProfile> _generatePModePayloadProfile ()
{
  final PModePayloadProfile aPModePayloadProfile = new PModePayloadProfile ("name",
                                                                            new MimeType (EMimeContentType.EXAMPLE,
                                                                                          "example"),
                                                                            "xsdfilename",
                                                                            20001,
                                                                            EMandatory.MANDATORY);
  final ICommonsOrderedMap <String, PModePayloadProfile> aPModePayloadProfiles = new CommonsLinkedHashMap<> ();
  aPModePayloadProfiles.put (aPModePayloadProfile.getName (), aPModePayloadProfile);
  return aPModePayloadProfiles;
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:15,代码来源:PModeMicroTypeConverterTest.java

示例2: CSSDataURL

import com.helger.commons.mime.MimeType; //导入依赖的package包/类
/**
 * Full constructor
 *
 * @param aMimeType
 *        The MIME type to be used. May not be <code>null</code>. If you don't
 *        know provide the default MIME type from
 *        {@link CSSDataURLHelper#DEFAULT_MIME_TYPE}.
 * @param bBase64Encoded
 *        <code>true</code> if the data URL String representation should be
 *        Base64 encoded, <code>false</code> if not. It is recommended to set
 *        this to <code>true</code> if you have binary data like images.
 * @param aContent
 *        The content of the data URL as a byte array. May not be
 *        <code>null</code> but may be empty. This content may not be Base64
 *        encoded!
 * @param aCharset
 *        The charset to be used to encode the String. May not be
 *        <code>null</code>. The default is
 *        {@link CSSDataURLHelper#DEFAULT_CHARSET}.
 * @param sContent
 *        The String representation of the content. It must match the byte
 *        array in the specified charset. If this parameter is
 *        <code>null</code> than the String content representation is lazily
 *        created in {@link #getContentAsString()}.
 */
public CSSDataURL (@Nonnull final IMimeType aMimeType,
                   final boolean bBase64Encoded,
                   @Nonnull final byte [] aContent,
                   @Nonnull final Charset aCharset,
                   @Nullable final String sContent)
{
  ValueEnforcer.notNull (aMimeType, "MimeType");
  ValueEnforcer.notNull (aContent, "Content");
  ValueEnforcer.notNull (aCharset, "Charset");

  // Check if a charset is contained in the MIME type and if it matches the
  // provided charset
  final Charset aMimeTypeCharset = MimeTypeHelper.getCharsetFromMimeType (aMimeType);
  if (aMimeTypeCharset == null)
  {
    // No charset found in MIME type
    if (!aCharset.equals (CSSDataURLHelper.DEFAULT_CHARSET))
    {
      // append charset only if it is not the default charset
      m_aMimeType = ((MimeType) aMimeType.getClone ()).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                                                     aCharset.name ());
    }
    else
    {
      // Default charset provided
      m_aMimeType = aMimeType;
    }
  }
  else
  {
    // MIME type has a charset - check if it matches the passed one
    if (!aMimeTypeCharset.equals (aCharset))
      throw new IllegalArgumentException ("The provided charset '" +
                                          aCharset.name () +
                                          "' differs from the charset in the MIME type: '" +
                                          aMimeTypeCharset.name () +
                                          "'");
    m_aMimeType = aMimeType;
  }
  m_bBase64Encoded = bBase64Encoded;
  m_aContent = ArrayHelper.getCopy (aContent);
  m_aCharset = aCharset;
  m_sContent = sContent;
}
 
开发者ID:phax,项目名称:ph-css,代码行数:70,代码来源:CSSDataURL.java


注:本文中的com.helger.commons.mime.MimeType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。