Package com.ubs.backend.classes.enums
Enum Class ByteConversion
- All Implemented Interfaces:
Serializable,Comparable<ByteConversion>,Constable
Enum to easily convert different units of Bytes
- Since:
- 17.07.2021
- Author:
- Marc Andri Fuchs
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe value with which a value has to be multiplied by to get it in Bytes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvert(double size, ByteConversion toUnit)Converts a Number from one Byte Unit to anotherstatic doubleconvert(double size, ByteConversion fromUnit, ByteConversion toUnit)Converts a Number from one Byte Unit to anotherstatic ByteConversionReturns the enum constant of this class with the specified name.static ByteConversion[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BYTE
-
KILOBYTE
-
MEGABYTE
-
GIGABYTE
-
-
Field Details
-
toByte
private final int toByteThe value with which a value has to be multiplied by to get it in Bytes- Since:
- 17.07.2021
-
-
Constructor Details
-
ByteConversion
private ByteConversion(int toByte)Default Constructor- Parameters:
toByte- The value with which a value has to be multiplied by to get it in Bytes- Since:
- 17.07.2021
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
convert
Converts a Number from one Byte Unit to another- Parameters:
size- the Size in fromUnitfromUnit- the origin UnittoUnit- the target Unit- Returns:
- the size converted from the fromUnit to the toUnit
- Since:
- 17.07.2021
-
convert
Converts a Number from one Byte Unit to another- Parameters:
size- the Size in fromUnittoUnit- the target Unit- Returns:
- the Size converted from this Unit to the toUnit
- Since:
- 17.07.2021
-