Enum Class DataUnit

java.lang.Object
java.lang.Enum<DataUnit>
org.miaixz.bus.core.io.unit.DataUnit
All Implemented Interfaces:
Serializable, Comparable<DataUnit>, Constable

public enum DataUnit extends Enum<DataUnit>
数据单位封装 此类来自于:Spring-framework
     BYTES      1B      2^0     1
     KILOBYTES  1KB     2^10    1,024
     MEGABYTES  1MB     2^20    1,048,576
     GIGABYTES  1GB     2^30    1,073,741,824
     TERABYTES  1TB     2^40    1,099,511,627,776
 
Since:
Java 17+
Author:
Kimi Liu
  • Enum Constant Details

    • BYTES

      public static final DataUnit BYTES
      Bytes, 后缀表示为: B.
    • KILOBYTES

      public static final DataUnit KILOBYTES
      Kilobytes, 后缀表示为: KB.
    • MEGABYTES

      public static final DataUnit MEGABYTES
      Megabytes, 后缀表示为: MB.
    • GIGABYTES

      public static final DataUnit GIGABYTES
      Gigabytes, 后缀表示为: GB.
    • TERABYTES

      public static final DataUnit TERABYTES
      Terabytes, 后缀表示为: TB.
  • Method Details

    • values

      public static DataUnit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      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.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromSuffix

      public static DataUnit fromSuffix(String suffix)
      通过后缀返回对应的 DataUnit
      Parameters:
      suffix - 单位后缀
      Returns:
      匹配到的DataUnit
      Throws:
      IllegalArgumentException - 后缀无法识别报错