Top Description Fields Constructors Methods
org.springframework.util.unit

public final Enum DataUnit

extends Enum<DataUnit>
Class Inheritance

A standard set of DataSize units.

The unit prefixes used in this class are binary prefixes indicating multiplication by powers of 2. The following table displays the enum constants defined in this class and corresponding values.

ConstantData SizePower of 2Size in Bytes
BYTES1B2^01
KILOBYTES1KB2^101,024
MEGABYTES1MB2^201,048,576
GIGABYTES1GB2^301,073,741,824
TERABYTES1TB2^401,099,511,627,776
Authors
Stephane Nicoll, Sam Brannen
Since
5.1
See Also
DataSize

Field Summary

Modifier and TypeField and Description
public static final DataUnit
BYTES

Bytes, represented by suffix B.

public static final DataUnit
GIGABYTES

Gigabytes, represented by suffix GB.

public static final DataUnit
KILOBYTES

Kilobytes, represented by suffix KB.

public static final DataUnit
MEGABYTES

Megabytes, represented by suffix MB.

private final DataSize
private final String
public static final DataUnit
TERABYTES

Terabytes, represented by suffix TB.

Constructor Summary

AccessConstructor and Description
private
DataUnit(String suffix, DataSize size)

Method Summary

Modifier and TypeMethod and Description
public static DataUnit

Returns:

the DataUnit matching the specified suffix
fromSuffix
(String
one of the standard suffixes
suffix
)

Return the DataUnit matching the specified suffix.

pack-priv DataSize
size()

public static DataUnit
public static DataUnit[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BYTESback to summary
public static final DataUnit BYTES

Bytes, represented by suffix B.

GIGABYTESback to summary
public static final DataUnit GIGABYTES

Gigabytes, represented by suffix GB.

KILOBYTESback to summary
public static final DataUnit KILOBYTES

Kilobytes, represented by suffix KB.

MEGABYTESback to summary
public static final DataUnit MEGABYTES

Megabytes, represented by suffix MB.

sizeback to summary
private final DataSize size
suffixback to summary
private final String suffix
TERABYTESback to summary
public static final DataUnit TERABYTES

Terabytes, represented by suffix TB.

Constructor Detail

DataUnitback to summary
private DataUnit(String suffix, DataSize size)

Method Detail

fromSuffixback to summary
public static DataUnit fromSuffix(String suffix)

Return the DataUnit matching the specified suffix.

Parameters
suffix:String

one of the standard suffixes

Returns:DataUnit

the DataUnit matching the specified suffix

Exceptions
IllegalArgumentException:
if the suffix does not match the suffix of any of this enum's constants
sizeback to summary
pack-priv DataSize size()
valueOfback to summary
public static DataUnit valueOf(String name)
valuesback to summary
public static DataUnit[] values()