| Modifier and Type | Field and Description |
|---|---|
static String |
GIGABYTE_STRING
Gigabyte string.
|
static String |
KILOBYTE_STRING
Kilobyte string.
|
static String |
MEGABYTE_STRING
Megabyte string.
|
| Constructor and Description |
|---|
GByteUnit(String unitName)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
convertFromMemory(BigDecimal value)
Converts the value from the memory unit.
|
double |
convertFromMemory(double value)
Converts the value from the memory unit.
|
BigDecimal |
convertToMemory(BigDecimal value)
Converts the value to the memory unit.
|
double |
convertToMemory(double value)
Converts the value to the memory unit.
|
BigDecimal |
convertToUnit(BigDecimal value,
GUnit destUnit)
Converts the units of value to unit.
|
double |
convertToUnit(double value,
GUnit destUnit)
Converts the units of value to unit.
|
String |
getCompactedName()
Returns the name of the unit decomposed in basicUnits, without multipliers and sorted.
|
String |
getName()
Get the unit name.
|
boolean |
isCompatible(GUnit unit)
Check if unit value is compatible
|
boolean |
isValidUnitName(String unitName)
Check the unit name validity
|
public static final String KILOBYTE_STRING
public static final String MEGABYTE_STRING
public static final String GIGABYTE_STRING
public GByteUnit(String unitName)
unitName - name of the unit. It must be a valid unit name.public boolean isValidUnitName(String unitName)
isValidUnitName in interface GUnitunitName - unit name string to test.public boolean isCompatible(GUnit unit)
isCompatible in interface GUnitunit - to check if it is compatible.public String getName()
public BigDecimal convertToUnit(BigDecimal value, GUnit destUnit) throws GException
GUnitconvertToUnit in interface GUnitvalue - to convert.destUnit - the destination unit.GException - in case of an error performing the conversion.public double convertToUnit(double value,
GUnit destUnit)
throws GException
GUnitconvertToUnit in interface GUnitvalue - to convert.destUnit - the destination unit.GException - in case of an error performing the conversion.public BigDecimal convertToMemory(BigDecimal value)
GUnitconvertToMemory in interface GUnitvalue - to convert.public double convertToMemory(double value)
GUnitconvertToMemory in interface GUnitvalue - to convert.public BigDecimal convertFromMemory(BigDecimal value)
GUnitconvertFromMemory in interface GUnitvalue - to convert.public double convertFromMemory(double value)
GUnitconvertFromMemory in interface GUnitvalue - to convert.public String getCompactedName()
GUnitgetCompactedName in interface GUnitCopyright © 2025. All rights reserved.