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


Java CGlobal.BYTES_PER_KILOBYTE属性代码示例

本文整理汇总了Java中com.helger.commons.CGlobal.BYTES_PER_KILOBYTE属性的典型用法代码示例。如果您正苦于以下问题:Java CGlobal.BYTES_PER_KILOBYTE属性的具体用法?Java CGlobal.BYTES_PER_KILOBYTE怎么用?Java CGlobal.BYTES_PER_KILOBYTE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.helger.commons.CGlobal的用法示例。


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

示例1: getNodeAsBytes

/**
 * Convert the passed DOM node to an XML byte array using the provided XML
 * writer settings.
 *
 * @param aNode
 *        The node to be converted to a byte array. May not be
 *        <code>null</code>.
 * @param aSettings
 *        The XML writer settings to be used. May not be <code>null</code>.
 * @return The byte array representation of the passed node.
 * @since 8.6.3
 */
@Nullable
public static byte [] getNodeAsBytes (@Nonnull final Node aNode, @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aNode, "Node");
  ValueEnforcer.notNull (aSettings, "Settings");

  try (final NonBlockingByteArrayOutputStream aWriter = new NonBlockingByteArrayOutputStream (50 *
                                                                                              CGlobal.BYTES_PER_KILOBYTE))
  {
    // start serializing
    if (writeToStream (aNode, aWriter, aSettings).isSuccess ())
      return aWriter.toByteArray ();
  }
  catch (final Throwable t)
  {
    s_aLogger.error ("Error serializing DOM node with settings " + aSettings.toString (), t);
  }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:31,代码来源:XMLWriter.java

示例2: getNodeAsString

/**
 * Convert the passed micro node to an XML string using the provided settings.
 *
 * @param aNode
 *        The node to be converted to a string. May not be <code>null</code> .
 * @param aSettings
 *        The XML writer settings to use. May not be <code>null</code>.
 * @return The string representation of the passed node.
 */
@Nullable
public static String getNodeAsString (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aNode, "Node");
  ValueEnforcer.notNull (aSettings, "Settings");

  try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE))
  {
    // start serializing
    if (writeToWriter (aNode, aWriter, aSettings).isSuccess ())
      return aWriter.getAsString ();
  }
  catch (final Throwable t)
  {
    s_aLogger.error ("Error serializing MicroDOM with settings " + aSettings.toString (), t);
  }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:27,代码来源:MicroWriter.java

示例3: getNodeAsBytes

/**
 * Convert the passed micro node to an XML byte array using the provided
 * settings.
 *
 * @param aNode
 *        The node to be converted to a byte array. May not be
 *        <code>null</code> .
 * @param aSettings
 *        The XML writer settings to use. May not be <code>null</code>.
 * @return The byte array representation of the passed node.
 * @since 8.6.3
 */
@Nullable
public static byte [] getNodeAsBytes (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aNode, "Node");
  ValueEnforcer.notNull (aSettings, "Settings");

  try (final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (50 *
                                                                                            CGlobal.BYTES_PER_KILOBYTE))
  {
    // start serializing
    if (writeToStream (aNode, aBAOS, aSettings).isSuccess ())
      return aBAOS.toByteArray ();
  }
  catch (final Throwable t)
  {
    s_aLogger.error ("Error serializing MicroDOM with settings " + aSettings.toString (), t);
  }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:31,代码来源:MicroWriter.java

示例4: getAsMatching

@Nonnull
public String getAsMatching (final long nSize)
{
  if (nSize >= CGlobal.BYTES_PER_PETABYTE)
    return getAsPB (nSize);
  if (nSize >= CGlobal.BYTES_PER_TERABYTE)
    return getAsTB (nSize);
  if (nSize >= CGlobal.BYTES_PER_GIGABYTE)
    return getAsGB (nSize);
  if (nSize >= CGlobal.BYTES_PER_MEGABYTE)
    return getAsMB (nSize);
  if (nSize >= CGlobal.BYTES_PER_KILOBYTE)
    return getAsKB (nSize);
  return _format (nSize) + B_SUFFIX;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:15,代码来源:SizeHelper.java

示例5: canBeKeptInMemory

public static boolean canBeKeptInMemory (final long nBytes)
{
  return nBytes <= 64 * CGlobal.BYTES_PER_KILOBYTE;
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:4,代码来源:WSS4JAttachment.java


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