org.apache.wicket.util.lang.Bytes.kilobytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(82)

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

Bytes.kilobytes介绍

[英]Gets the byte count in kilobytes.
[中]获取以KB为单位的字节计数。

代码示例

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Gets the byte count in megabytes.
 * 
 * @return The value in megabytes
 */
public final double megabytes()
{
  return kilobytes() / 1024.0;
}

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final long megabytes)
{
  return kilobytes(megabytes * 1024);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final double megabytes)
{
  return kilobytes(megabytes * 1024.0);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final long megabytes)
{
  return kilobytes(megabytes * 1024);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final long megabytes)
{
  return kilobytes(megabytes * 1024);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Gets the byte count in megabytes.
 * 
 * @return The value in megabytes
 */
public final double megabytes()
{
  return kilobytes() / 1024.0;
}

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final double megabytes)
{
  return kilobytes(megabytes * 1024.0);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Gets the byte count in megabytes.
 * 
 * @return The value in megabytes
 */
public final double megabytes()
{
  return kilobytes() / 1024.0;
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Instantiate immutable Bytes value object..
 * 
 * @param megabytes
 *            Value to convert
 * @return Input as Bytes
 */
public static Bytes megabytes(final double megabytes)
{
  return kilobytes(megabytes * 1024.0);
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

@Override
  public String diff(final String originalValue, final String currentValue) {
    Bytes maxDiffSize = Bytes.valueOf(params.getString(MAX_DIFF_SIZE, DEFAULT_MAX_DIFF_SIZE));
    final int maxLenSize = Math.max(originalValue.length(), currentValue.length());

    try {
      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
      if (maxLenSize <= maxDiffSize.bytes()){
        DiffHelper.diffHtml(originalValue, currentValue, new StreamResult(baos),
            Session.get().getLocale());
        return baos.toString("UTF-8");
      } else {
        log.warn("Unable to diff a large content of size {} KB, which is exceeds the limitation {} KB ",
            Bytes.bytes(maxLenSize).kilobytes(), maxDiffSize.kilobytes());
      }
    } catch (TransformerConfigurationException e) {
      log.error(e.getMessage(), e);
    } catch (SAXException e) {
      log.info(e.getMessage(), e);
    } catch (IOException e) {
      log.error(e.getMessage());
    }
    return null;
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

return kilobytes(value);

代码示例来源:origin: org.apache.wicket/wicket-util

return kilobytes(value);

代码示例来源:origin: MarcGiffing/wicket-spring-boot

public static Bytes parse(Long size, SessionUnit sessionUnit){
  switch(sessionUnit){
  case BYTES:
    return Bytes.bytes(size);
  case KILOBYTES:
    return Bytes.kilobytes(size);
  case MEGABYTES:
    return Bytes.megabytes(size);
  case TERABYTES:
    return Bytes.terabytes(size);
  }
  throw new WicketSpringBootException("Could not parse size with session unit " + size + " " + sessionUnit);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

return kilobytes(value);

代码示例来源:origin: com.giffing.wicket.spring.boot.starter/wicket-spring-boot-context

public static Bytes parse(Long size, SessionUnit sessionUnit){
  switch(sessionUnit){
  case BYTES:
    return Bytes.bytes(size);
  case KILOBYTES:
    return Bytes.kilobytes(size);
  case MEGABYTES:
    return Bytes.megabytes(size);
  case TERABYTES:
    return Bytes.terabytes(size);
  }
  throw new WicketSpringBootException("Could not parse size with session unit " + size + " " + sessionUnit);
}

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Converts this byte count to a string using the given locale.
 * 
 * @param locale
 *            Locale to use for conversion
 * @return The string for this byte count
 */
public String toString(final Locale locale)
{
  if (terabytes() >= 1.0)
  {
    return unitString(terabytes(), "TB", locale);
  }
  if (gigabytes() >= 1.0)
  {
    return unitString(gigabytes(), "GB", locale);
  }
  if (megabytes() >= 1.0)
  {
    return unitString(megabytes(), "MB", locale);
  }
  if (kilobytes() >= 1.0)
  {
    return unitString(kilobytes(), "KB", locale);
  }
  return Long.toString(value) + " bytes";
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

if (kilobytes() >= 1.0)
  return unitString(kilobytes(), "K", locale);

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

if (kilobytes() >= 1.0)
  return unitString(kilobytes(), "K", locale);

相关文章