Package io.github.mfvanek.pg.model
Enum MemoryUnit
- java.lang.Object
-
- java.lang.Enum<MemoryUnit>
-
- io.github.mfvanek.pg.model.MemoryUnit
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MemoryUnit>
public enum MemoryUnit extends java.lang.Enum<MemoryUnit>
Units of information.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
convertToBytes(int unitsCount)
Converts given information units amount to bytes according to itdimension
.java.lang.String
toString()
static MemoryUnit
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static MemoryUnit[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
KB
public static final MemoryUnit KB
-
MB
public static final MemoryUnit MB
-
GB
public static final MemoryUnit GB
-
-
Method Detail
-
values
public static MemoryUnit[] 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 (MemoryUnit c : MemoryUnit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MemoryUnit 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 namejava.lang.NullPointerException
- if the argument is null
-
convertToBytes
public long convertToBytes(int unitsCount)
Converts given information units amount to bytes according to itdimension
.- Parameters:
unitsCount
- information units amount- Returns:
- size in bytes
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<MemoryUnit>
-
-