Enum Constant and Description |
---|
BYTES
bytes
|
EXABYTE
exabyte
|
GIGABYTE
gigabyte
|
KILOBYTE
kilobyte
|
MEGABYTE
megabyte
|
PETABYTE
petabyte
|
TERABYTE
terabyte
|
Modifier and Type | Method and Description |
---|---|
double |
convert(long numbytes)
Converts the number of bytes to the size.
|
long |
getNumbytes()
Get the number of bytes per unit.
|
static void |
getText(java.lang.StringBuilder sb,
double size,
SizeUnit sizeUnit)
Gets the text for the size and size unit.
|
static void |
getText(java.lang.StringBuilder sb,
long numbytes,
SizeUnit... sizeUnits)
Get the size text for the number of bytes in the largest size unit where
the size is at least one.
|
java.lang.String |
toString() |
static SizeUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static SizeUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SizeUnit BYTES
public static final SizeUnit EXABYTE
public static final SizeUnit GIGABYTE
public static final SizeUnit KILOBYTE
public static final SizeUnit MEGABYTE
public static final SizeUnit PETABYTE
public static final SizeUnit TERABYTE
public static SizeUnit[] values()
for (SizeUnit c : SizeUnit.values()) System.out.println(c);
public static SizeUnit valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static void getText(java.lang.StringBuilder sb, double size, SizeUnit sizeUnit)
sb
- the string builder.size
- the size in the specified size unit.sizeUnit
- the size unit.public static void getText(java.lang.StringBuilder sb, long numbytes, SizeUnit... sizeUnits)
sb
- the string builder.numbytes
- the number of bytes.sizeUnits
- the size units or an empty array for all.public double convert(long numbytes)
numbytes
- the number of bytes.public long getNumbytes()
public java.lang.String toString()
toString
in class java.lang.Enum<SizeUnit>