public enum ByteUnit extends Enum<ByteUnit>
The unit knows how to convert between other units in its class, so you for instance can turn a number of KiBs into an accurate quantity of bytes. Precision can be lost when converting smaller units into larger units, because of integer division.
These units all follow the EIC (International Electrotechnical Commission) standard, which uses a multiplier of 1.024. This system is also known as the binary system, and has been accepted as part of the International System of Quantities. It is therefor the recommended choice when communicating quantities of information, and the only one available in this implementation.
| Enum Constant and Description |
|---|
Byte |
ExbiByte |
GibiByte |
KibiByte |
MebiByte |
PebiByte |
TebiByte |
| Modifier and Type | Method and Description |
|---|---|
String |
abbreviation()
Get the short or abbreviated name of this unit, e.g.
|
static long |
bytes(long bytes) |
long |
convert(long value,
ByteUnit toUnit)
Convert the given value of this unit, to a value in the given unit.
|
static long |
exbiBytes(long exbibytes) |
static long |
gibiBytes(long gibibytes) |
static long |
kibiBytes(long kibibytes) |
static long |
mebiBytes(long mebibytes) |
static long |
pebiBytes(long pebibytes) |
static long |
tebiBytes(long tebibytes) |
long |
toBytes(long value) |
long |
toExbiBytes(long value) |
long |
toGibiBytes(long value) |
long |
toKibiBytes(long value) |
long |
toMebiBytes(long value) |
long |
toPebiBytes(long value) |
long |
toTebiBytes(long value) |
static ByteUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ByteUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ByteUnit Byte
public static final ByteUnit KibiByte
public static final ByteUnit MebiByte
public static final ByteUnit GibiByte
public static final ByteUnit TebiByte
public static final ByteUnit PebiByte
public static final ByteUnit ExbiByte
public static ByteUnit[] values()
for (ByteUnit c : ByteUnit.values()) System.out.println(c);
public static ByteUnit valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String abbreviation()
public long convert(long value,
ByteUnit toUnit)
value - The value to convert from this unit.toUnit - The unit of the resulting value.public long toBytes(long value)
public long toKibiBytes(long value)
public long toMebiBytes(long value)
public long toGibiBytes(long value)
public long toTebiBytes(long value)
public long toPebiBytes(long value)
public long toExbiBytes(long value)
public static long bytes(long bytes)
public static long kibiBytes(long kibibytes)
public static long mebiBytes(long mebibytes)
public static long gibiBytes(long gibibytes)
public static long tebiBytes(long tebibytes)
public static long pebiBytes(long pebibytes)
public static long exbiBytes(long exbibytes)
Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.