Enum Class ByteConversion

java.lang.Object
java.lang.Enum<ByteConversion>
com.ubs.backend.classes.enums.ByteConversion
All Implemented Interfaces:
Serializable, Comparable<ByteConversion>, Constable

public enum ByteConversion extends Enum<ByteConversion>
Enum to easily convert different units of Bytes
Since:
17.07.2021
Author:
Marc Andri Fuchs
  • Enum Constant Details

  • Field Details

    • toByte

      private final int toByte
      The 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

      public static ByteConversion[] 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

      public static ByteConversion valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • convert

      public static double convert(double size, ByteConversion fromUnit, ByteConversion toUnit)
      Converts a Number from one Byte Unit to another
      Parameters:
      size - the Size in fromUnit
      fromUnit - the origin Unit
      toUnit - the target Unit
      Returns:
      the size converted from the fromUnit to the toUnit
      Since:
      17.07.2021
    • convert

      public double convert(double size, ByteConversion toUnit)
      Converts a Number from one Byte Unit to another
      Parameters:
      size - the Size in fromUnit
      toUnit - the target Unit
      Returns:
      the Size converted from this Unit to the toUnit
      Since:
      17.07.2021