Enum MemorySize.MemoryUnit

  • All Implemented Interfaces:
    Serializable, Comparable<MemorySize.MemoryUnit>
    Enclosing class:
    MemorySize

    public static enum MemorySize.MemoryUnit
    extends Enum<MemorySize.MemoryUnit>
    Enum which defines memory unit, mostly used to parse value from configuration file.

    To make larger values more compact, the common size suffixes are supported:

    • 1b or 1bytes (bytes)
    • 1k or 1kb or 1kibibytes (interpreted as kibibytes = 1024 bytes)
    • 1m or 1mb or 1mebibytes (interpreted as mebibytes = 1024 kibibytes)
    • 1g or 1gb or 1gibibytes (interpreted as gibibytes = 1024 mebibytes)
    • 1t or 1tb or 1tebibytes (interpreted as tebibytes = 1024 gibibytes)
    • Method Detail

      • values

        public static MemorySize.MemoryUnit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MemorySize.MemoryUnit c : MemorySize.MemoryUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MemorySize.MemoryUnit valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • getUnits

        public String[] getUnits()
      • getMultiplier

        public long getMultiplier()
      • getAllUnits

        public static String getAllUnits()
      • hasUnit

        public static boolean hasUnit​(String text)