Package cn.sliew.milky.common.unit
Enum ByteUnit
- java.lang.Object
-
- java.lang.Enum<ByteUnit>
-
- cn.sliew.milky.common.unit.ByteUnit
-
- All Implemented Interfaces:
Serializable,Comparable<ByteUnit>
public enum ByteUnit extends Enum<ByteUnit>
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ByteUnitfromOrdinal(int ordinal)abstract StringgetSuffix()abstract longtoBytes(long size)abstract longtoGB(long size)abstract longtoKB(long size)abstract longtoMB(long size)abstract longtoPB(long size)abstract longtoTB(long size)static ByteUnitvalueOf(String name)Returns the enum constant of this type with the specified name.static ByteUnit[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static ByteUnit[] 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 (ByteUnit c : ByteUnit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ByteUnit 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
-
fromOrdinal
public static ByteUnit fromOrdinal(int ordinal)
-
toBytes
public abstract long toBytes(long size)
-
toKB
public abstract long toKB(long size)
-
toMB
public abstract long toMB(long size)
-
toGB
public abstract long toGB(long size)
-
toTB
public abstract long toTB(long size)
-
toPB
public abstract long toPB(long size)
-
getSuffix
public abstract String getSuffix()
-
-