Enum Class DataUnit

java.lang.Object
java.lang.Enum<DataUnit>
cn.taketoday.util.DataUnit
所有已实现的接口:
Serializable, Comparable<DataUnit>, Constable

public enum DataUnit extends Enum<DataUnit>
A standard set of DataSize units.

The unit prefixes used in this class are binary prefixes indicating multiplication by powers of 2. The following table displays the enum constants defined in this class and corresponding values.

ConstantData SizePower of 2Size in Bytes
BYTES1B2^01
KILOBYTES1KB2^101,024
MEGABYTES1MB2^201,048,576
GIGABYTES1GB2^301,073,741,824
TERABYTES1TB2^401,099,511,627,776
从以下版本开始:
2.1.3
作者:
Stephane Nicoll, TODAY
  • 枚举常量详细资料

    • BYTES

      public static final DataUnit BYTES
      Bytes.
    • KILOBYTES

      public static final DataUnit KILOBYTES
      Kilobytes.
    • MEGABYTES

      public static final DataUnit MEGABYTES
      Megabytes.
    • GIGABYTES

      public static final DataUnit GIGABYTES
      Gigabytes.
    • TERABYTES

      public static final DataUnit TERABYTES
      Terabytes.
  • 字段详细资料

    • suffix

      private final String suffix
    • size

      private final DataSize size
  • 构造器详细资料

  • 方法详细资料

    • values

      public static DataUnit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      返回:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DataUnit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - 如果参数为空值
    • size

      DataSize size()
    • fromSuffix

      public static DataUnit fromSuffix(String suffix)
      Return the DataUnit matching the specified suffix.
      参数:
      suffix - one of the standard suffixes
      返回:
      the DataUnit matching the specified suffix
      抛出:
      IllegalArgumentException - if the suffix does not match the suffix of any of this enum's constants