systeminformationmonitor.util
Enum StorageUnit
java.lang.Object
java.lang.Enum<StorageUnit>
systeminformationmonitor.util.StorageUnit
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<StorageUnit>
public enum StorageUnit
- extends java.lang.Enum<StorageUnit>
Converting a long to a formatted String.
Typical Use: StorageUnit.of(number).format(number);
- See Also:
- this thread
|
Method Summary |
java.lang.String |
format(long number)
format a given long number |
static StorageUnit |
of(long number)
Method used to indicate which number should be used for conversion. |
static StorageUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static StorageUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared. |
| Methods inherited from class java.lang.Enum |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
BYTE
public static final StorageUnit BYTE
KILOBYTE
public static final StorageUnit KILOBYTE
MEGABYTE
public static final StorageUnit MEGABYTE
GIGABYTE
public static final StorageUnit GIGABYTE
TERABYTE
public static final StorageUnit TERABYTE
PETABYTE
public static final StorageUnit PETABYTE
EXABYTE
public static final StorageUnit EXABYTE
BASE
public static final StorageUnit BASE
values
public static StorageUnit[] 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 (StorageUnit c : StorageUnit.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static StorageUnit valueOf(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name
java.lang.NullPointerException - if the argument is null
of
public static StorageUnit of(long number)
- Method used to indicate which number should be used for conversion.
- Parameters:
number - unformated number in bytes
- Returns:
- StorageUnit
format
public java.lang.String format(long number)
- format a given long number
- Parameters:
number - a unformatted number
- Returns:
- a formatted String