Enum SParser.TraditionalBinaryPrefix

  • All Implemented Interfaces:

    
    public enum SParser.TraditionalBinaryPrefix
    
                        

    The traditional binary prefixes, kilo, mega, ..., exa, which can be represented by a 64-bit integer. TraditionalBinaryPrefix symbol are case insensitive.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final long value
      public final char symbol
      public final int bitShift
      public final long bitMask
    • Constructor Summary

      Constructors 
      Constructor Description
    • Constructor Detail

    • Method Detail

      • string2long

         static long string2long(String s)

        Convert a string to long. The input string is first be trimmed and then it is parsed with traditional binary prefix.

        For example, "-1230k" will be converted to -1230 * 1024 = -1259520; "891g" will be converted to 891 * 1024^3 = 956703965184;

        Parameters:
        s - input string
        Returns:

        a long value represented by the input string.

      • long2String

         static String long2String(long n, String unit, int decimalPlaces)

        Convert a long integer to a string with traditional binary prefix.

        Parameters:
        n - the value to be converted
        unit - The unit, e.g.
        decimalPlaces - The number of decimal places.
        Returns:

        a string with traditional binary prefix.

      • values

         static Array<SParser.TraditionalBinaryPrefix> values()

        Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

        Returns:

        an array containing the constants of this enum type, in the order they're declared

      • valueOf

         static SParser.TraditionalBinaryPrefix 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.)

        Returns:

        the enum constant with the specified name