public class DataSize extends Object implements Comparable<DataSize>, Serializable
DataSizeUnit,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
static DataSize |
bytes(long count)
Constructs a new
DataSize object representing the specified amount of bytes. |
int |
compareTo(DataSize other) |
boolean |
equals(Object obj) |
static DataSize |
fromSize(Size size)
|
long |
getQuantity()
Gets the quantity of the current
DataSize object. |
DataSizeUnit |
getUnit()
Returns the
data size unit of the current DataSize object. |
static DataSize |
gibibytes(long count)
Constructs a new
DataSize object representing the specified amount of gibibytes. |
static DataSize |
gigabytes(long count)
Constructs a new
DataSize object representing the specified amount of gigabytes. |
int |
hashCode() |
static DataSize |
kibibytes(long count)
Constructs a new
DataSize object representing the specified amount of kibibytes. |
static DataSize |
kilobytes(long count)
Constructs a new
DataSize object representing the specified amount of kilobytes. |
static DataSize |
mebibytes(long count)
Constructs a new
DataSize object representing the specified amount of mebibytes. |
static DataSize |
megabytes(long count)
Constructs a new
DataSize object representing the specified amount of megabytes. |
static DataSize |
parse(CharSequence size)
Parses a given
CharSequence to a DataSize object. |
static DataSize |
parse(CharSequence size,
DataSizeUnit defaultUnit)
Parses a given
CharSequence to a DataSize object. |
static DataSize |
pebibytes(long count)
Constructs a new
DataSize object representing the specified amount of pebibytes. |
static DataSize |
petabytes(long count)
Constructs a new
DataSize object representing the specified amount of petabytes. |
static DataSize |
tebibytes(long count)
Constructs a new
DataSize object representing the specified amount of tebibytes. |
static DataSize |
terabytes(long count)
Constructs a new
DataSize object representing the specified amount of terabytes. |
long |
toBytes()
Returns the quantity of the current
DataSize object in bytes. |
long |
toGibibytes()
Returns the quantity of the current
DataSize object in gibibytes. |
long |
toGigabytes()
Returns the quantity of the current
DataSize object in gigabytes. |
long |
toKibibytes()
Returns the quantity of the current
DataSize object in kibibytes. |
long |
toKilobytes()
Returns the quantity of the current
DataSize object in kilobytes. |
long |
toMebibytes()
Returns the quantity of the current
DataSize object in mebibytes. |
long |
toMegabytes()
Returns the quantity of the current
DataSize object in megabytes. |
long |
toPebibytes()
Returns the quantity of the current
DataSize object in pebibytes. |
long |
toPetabytes()
Returns the quantity of the current
DataSize object in petabytes. |
Size |
toSize()
|
String |
toString() |
long |
toTebibytes()
Returns the quantity of the current
DataSize object in gebibytes. |
long |
toTerabytes()
Returns the quantity of the current
DataSize object in terabytes. |
public static DataSize bytes(long count)
DataSize object representing the specified amount of bytes.count - the amount of bytesDataSize objectpublic static DataSize kilobytes(long count)
DataSize object representing the specified amount of kilobytes.count - the amount of kilobytesDataSize objectpublic static DataSize megabytes(long count)
DataSize object representing the specified amount of megabytes.count - the amount of megabytesDataSize objectpublic static DataSize gigabytes(long count)
DataSize object representing the specified amount of gigabytes.count - the amount of gigabytesDataSize objectpublic static DataSize terabytes(long count)
DataSize object representing the specified amount of terabytes.count - the amount of terabytesDataSize objectpublic static DataSize petabytes(long count)
DataSize object representing the specified amount of petabytes.count - the amount of petabytesDataSize objectpublic static DataSize kibibytes(long count)
DataSize object representing the specified amount of kibibytes.count - the amount of kibibytesDataSize objectpublic static DataSize mebibytes(long count)
DataSize object representing the specified amount of mebibytes.count - the amount of mebibytesDataSize objectpublic static DataSize gibibytes(long count)
DataSize object representing the specified amount of gibibytes.count - the amount of gibibytesDataSize objectpublic static DataSize tebibytes(long count)
DataSize object representing the specified amount of tebibytes.count - the amount of tebibytesDataSize objectpublic static DataSize pebibytes(long count)
DataSize object representing the specified amount of pebibytes.count - the amount of pebibytesDataSize objectpublic static DataSize parse(CharSequence size)
CharSequence to a DataSize object.
If no unit is provided by the input sequence, a default unit of DataSizeUnit.BYTES is used.public static DataSize parse(CharSequence size, DataSizeUnit defaultUnit)
CharSequence to a DataSize object.
If no unit is provided by the input sequence, the default unit parameter is used.size - the string representation of the DataSize to parsedefaultUnit - the fallback default unit to use for the newly created DataSizeDataSize object representing the parsed stringIllegalArgumentException - if the input sequence cannot be parsed correctlypublic long getQuantity()
DataSize object.public DataSizeUnit getUnit()
data size unit of the current DataSize object.public long toBytes()
DataSize object in bytes.public long toKilobytes()
DataSize object in kilobytes.public long toMegabytes()
DataSize object in megabytes.public long toGigabytes()
DataSize object in gigabytes.public long toTerabytes()
DataSize object in terabytes.public long toPetabytes()
DataSize object in petabytes.public long toKibibytes()
DataSize object in kibibytes.public long toMebibytes()
DataSize object in mebibytes.public long toGibibytes()
DataSize object in gibibytes.public long toTebibytes()
DataSize object in gebibytes.public long toPebibytes()
DataSize object in pebibytes.public int compareTo(DataSize other)
compareTo in interface Comparable<DataSize>@Deprecated public Size toSize()
Size object@Deprecated public static DataSize fromSize(Size size)
Copyright © 2011. All rights reserved.