Package | Description |
---|---|
com.norconex.commons.lang.unit |
Classes making it easier to deal with unit conversions and formatting.
|
com.norconex.commons.lang.xml |
XML-related classes.
|
Modifier and Type | Field and Description |
---|---|
static List<DataUnit> |
DataUnit.BINARY_BIT_UNITS |
static List<DataUnit> |
DataUnit.BINARY_BYTE_UNITS |
static List<DataUnit> |
DataUnit.DECIMAL_BIT_UNITS |
static List<DataUnit> |
DataUnit.DECIMAL_BYTE_UNITS |
Modifier and Type | Method and Description |
---|---|
static DataUnit |
DataUnit.from(String dataUnit)
Gets the unit value representing the given text.
|
static DataUnit |
DataUnit.valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DataUnit[] |
DataUnit.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
Modifier and Type | Method and Description |
---|---|
long |
DataUnit.convert(long sourceAmount,
DataUnit sourceUnit)
Deprecated.
Since 2.0.0, use
from(BigDecimal, DataUnit) |
String |
DataUnitFormatter.format(BigDecimal amount,
DataUnit unit)
Formats a data amount of the given unit to a human-readable
representation.
|
String |
DataUnitFormatter.format(double amount,
DataUnit unit)
Formats a data amount of the given unit to a human-readable
representation.
|
BigDecimal |
DataUnit.from(BigDecimal sourceAmount,
DataUnit sourceUnit)
Converts an amount of a specific unit to this unit.
|
BigDecimal |
DataUnit.from(double sourceAmount,
DataUnit sourceUnit)
Converts an amount of a specific unit to this unit.
|
static BigDecimal |
DataUnitParser.parse(String text,
DataUnit targetUnit)
Parses a text representation of a data measurement.
|
static BigDecimal |
DataUnitParser.parse(String text,
DataUnit targetUnit,
BigDecimal defaultValue)
Parses a text representation of a data measurement.
|
BigDecimal |
DataUnit.to(BigDecimal sourceAmount,
DataUnit targetUnit) |
BigDecimal |
DataUnit.to(double sourceAmount,
DataUnit targetUnit) |
Modifier and Type | Method and Description |
---|---|
Long |
XML.getDataSize(String xpathExpression,
DataUnit targetUnit,
Long defaultValue)
Gets the size of a data expression, in the specified target unit
(e.g., 2KB, 1GiB, 3 megabytes, etc).
|
Copyright © 2008–2023 Norconex Inc.. All rights reserved.