See: Description
| Interface | Description |
|---|---|
| ByteUnit |
A
ByteUnit represents a size at a given unit of granularity which can be converted
into bytes. |
| Enum | Description |
|---|---|
| BinaryByteUnit |
A
BinaryByteUnit represents power-of-two byte sizes at a given unit of granularity and
provides utility methods to convert across units. |
| BitUnit |
A
BitUnit represents bit size at a given unit of granularity and provides utility
methods to convert across units. |
| DecimalByteUnit |
A
DecimalByteUnit represents power-of-ten byte sizes at a given unit of granularity and
provides utility methods to convert across units. |
long perception = DecimalByteUnit.TERABYTES.toBytes(2);
long usable = BinaryByteUnit.TEBIBYTES.toBytes(2);
long lost = BinaryByteUnit.BYTES.toGibibytes(perception - usable);
System.out.println(lost + " GiB lost on a 2TB drive.");
Method parameter for specifying a resource size.
public void installDiskCache(long count, ByteUnit unit) {
long size = unit.toBytes(count);
// TODO Install disk cache of 'size' bytes.
}
Copyright © 2014. All Rights Reserved.