Package adams.core
Enum ByteFormat.Unit
- java.lang.Object
-
- java.lang.Enum<ByteFormat.Unit>
-
- adams.core.ByteFormat.Unit
-
- All Implemented Interfaces:
Serializable
,Comparable<ByteFormat.Unit>
- Enclosing class:
- ByteFormat
public static enum ByteFormat.Unit extends Enum<ByteFormat.Unit>
The available units.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BYTES
EXA_BYTES
EXBI_BYTES
GIBI_BYTES
GIGA_BYTES
KIBI_BYTES
KILO_BYTES
MEBI_BYTES
MEGA_BYTES
PEBI_BYTES
PETA_BYTES
TEBI_BYTES
TERA_BYTES
YOBI_BYTES
YOTTA_BYTES
ZEBI_BYTES
ZETTA_BYTES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBase()
Returns the base.int
getPower()
Returns the power to base.String
getUnit()
Returns the unit string.static ByteFormat.Unit
parse(String s)
Parses the given string (k|K|m|M|g|G|t|T|p|P|e|E|z|Z|y|Y)(i)? and returns the corresponding unit.static ByteFormat.Unit
valueOf(String name)
Returns the enum constant of this type with the specified name.static ByteFormat.Unit[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BYTES
public static final ByteFormat.Unit BYTES
-
KILO_BYTES
public static final ByteFormat.Unit KILO_BYTES
-
MEGA_BYTES
public static final ByteFormat.Unit MEGA_BYTES
-
GIGA_BYTES
public static final ByteFormat.Unit GIGA_BYTES
-
TERA_BYTES
public static final ByteFormat.Unit TERA_BYTES
-
PETA_BYTES
public static final ByteFormat.Unit PETA_BYTES
-
EXA_BYTES
public static final ByteFormat.Unit EXA_BYTES
-
ZETTA_BYTES
public static final ByteFormat.Unit ZETTA_BYTES
-
YOTTA_BYTES
public static final ByteFormat.Unit YOTTA_BYTES
-
KIBI_BYTES
public static final ByteFormat.Unit KIBI_BYTES
-
MEBI_BYTES
public static final ByteFormat.Unit MEBI_BYTES
-
GIBI_BYTES
public static final ByteFormat.Unit GIBI_BYTES
-
TEBI_BYTES
public static final ByteFormat.Unit TEBI_BYTES
-
PEBI_BYTES
public static final ByteFormat.Unit PEBI_BYTES
-
EXBI_BYTES
public static final ByteFormat.Unit EXBI_BYTES
-
ZEBI_BYTES
public static final ByteFormat.Unit ZEBI_BYTES
-
YOBI_BYTES
public static final ByteFormat.Unit YOBI_BYTES
-
-
Method Detail
-
values
public static ByteFormat.Unit[] 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 (ByteFormat.Unit c : ByteFormat.Unit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ByteFormat.Unit 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 nameNullPointerException
- if the argument is null
-
getBase
public int getBase()
Returns the base.- Returns:
- the base
-
getPower
public int getPower()
Returns the power to base.- Returns:
- the power
-
getUnit
public String getUnit()
Returns the unit string.- Returns:
- the unit string
-
parse
public static ByteFormat.Unit parse(String s)
Parses the given string (k|K|m|M|g|G|t|T|p|P|e|E|z|Z|y|Y)(i)? and returns the corresponding unit.- Parameters:
s
- the string to parse- Returns:
- the unit, null if invalid string
-
-