StringUtils.TraditionalBinaryPrefix (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: StringUtils, enum: TraditionalBinaryPrefix

Package org.apache.hadoop.util

# Enum Class StringUtils.TraditionalBinaryPrefix

java.lang.Object
java.lang.Enum<StringUtils.TraditionalBinaryPrefix>
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix

All Implemented Interfaces:
  `Serializable`, `Comparable<StringUtils.TraditionalBinaryPrefix>`, `Constable`

Enclosing class:
  org.apache.hadoop.util.StringUtils

public static enum StringUtils.TraditionalBinaryPrefix extends Enum<StringUtils.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/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `EXA`
  `GIGA`
  `KILO`
  `MEGA`
  `PETA`
  `TERA`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final long`
  `bitMask`
  `final int`
  `bitShift`
  `final char`
  `symbol`
  `final long`
  `value`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `long2String(long n, String unit, int decimalPlaces)`
  Convert a long integer to a string with traditional binary prefix.
  `static long`
  `string2long(String s)`
  Convert a string to long.
  `static StringUtils.TraditionalBinaryPrefix`
  `valueOf(char symbol)`
  The TraditionalBinaryPrefix object corresponding to the symbol.
  `static StringUtils.TraditionalBinaryPrefix`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static StringUtils.TraditionalBinaryPrefix[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### KILO

    public static final StringUtils.TraditionalBinaryPrefix KILO

  - ### MEGA

    public static final StringUtils.TraditionalBinaryPrefix MEGA

  - ### GIGA

    public static final StringUtils.TraditionalBinaryPrefix GIGA

  - ### TERA

    public static final StringUtils.TraditionalBinaryPrefix TERA

  - ### PETA

    public static final StringUtils.TraditionalBinaryPrefix PETA

  - ### EXA

    public static final StringUtils.TraditionalBinaryPrefix EXA

- ## Field Details

  - ### value

    public final long value

  - ### symbol

    public final char symbol

  - ### bitShift

    public final int bitShift

  - ### bitMask

    public final long bitMask

- ## Method Details

  - ### values

    public static StringUtils.TraditionalBinaryPrefix[] 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 StringUtils.TraditionalBinaryPrefix 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

  - ### valueOf

    public static StringUtils.TraditionalBinaryPrefix valueOf(char symbol)
    The TraditionalBinaryPrefix object corresponding to the symbol.
    Parameters:
      `symbol` - symbol.
    Returns:
      traditional binary prefix object.

  - ### string2long

    public 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

    public 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. "B" for bytes.
      `decimalPlaces` - The number of decimal places.
    Returns:
      a string with traditional binary prefix.