| Modifier and Type | Field and Description |
|---|---|
| public static final MemoryUnit | BYTES
BYTES |
| public static final MemoryUnit | GIGABYTES
GIGABYTES (1024 MEGABYTES) |
| public static final MemoryUnit | KILOBYTES
KILOBYTES (1024 BYTES) |
| public static final MemoryUnit | MEGABYTES
MEGABYTES (1024 KILOBYTES) |
| private static final int | |
| private final int | |
| private final char |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static MemoryUnit | Returns: the MemoryUnit instance matching the unitthe unit to look for unit)Returns the MemoryUnit instance based on provided char |
| public char | |
| private static boolean | |
| public static long | Returns: the amount of mem in the unit represented by the potential unit charthe String representation of an amount of memory value)Parses the amount represented by the string, without caring for the unit |
| public static long | Returns: the amount of bytes represented by the stringthe String representation of an amount of memory value)Parses the string for its content, returning the represented value in bytes |
| public static MemoryUnit | Returns: the MemoryUnit instance, or BYTES if nonethe String representation of an amount of memory value)Parses the unit part of a String, if no unit char available, returns |
| private static long | |
| public abstract long | |
| public abstract long | |
| public abstract long | |
| public abstract long | |
| public String | Returns: the String representationthe amount to print amount)Human readable value, with the added unit character as a suffix |
| public static MemoryUnit | |
| public static MemoryUnit[] |
| BYTES | back to summary |
|---|---|
| public static final MemoryUnit BYTES BYTES | |
| GIGABYTES | back to summary |
|---|---|
| public static final MemoryUnit GIGABYTES GIGABYTES (1024 MEGABYTES) | |
| KILOBYTES | back to summary |
|---|---|
| public static final MemoryUnit KILOBYTES KILOBYTES (1024 BYTES) | |
| MEGABYTES | back to summary |
|---|---|
| public static final MemoryUnit MEGABYTES MEGABYTES (1024 KILOBYTES) | |
| OFFSET | back to summary |
|---|---|
| private static final int OFFSET | |
| offset | back to summary |
|---|---|
| private final int offset | |
| unit | back to summary |
|---|---|
| private final char unit | |
| MemoryUnit | back to summary |
|---|---|
| private MemoryUnit(final int offset, final char unit) | |
| forUnit | back to summary |
|---|---|
| public static MemoryUnit forUnit(final char unit) throws IllegalArgumentException Returns the MemoryUnit instance based on provided char
| |
| getUnit | back to summary |
|---|---|
| public char getUnit() Retrieves the unit character for the MemoryUnit
| |
| hasUnit | back to summary |
|---|---|
| private static boolean hasUnit(final String value) | |
| parseAmount | back to summary |
|---|---|
| public static long parseAmount(final String value) throws NumberFormatException Parses the amount represented by the string, without caring for the unit
| |
| parseSizeInBytes | back to summary |
|---|---|
| public static long parseSizeInBytes(final String value) throws NumberFormatException, IllegalArgumentException Parses the string for its content, returning the represented value in bytes
| |
| parseUnit | back to summary |
|---|---|
| public static MemoryUnit parseUnit(final String value) Parses the unit part of a String, if no unit char available, returns
| |
| safeShift | back to summary |
|---|---|
| private static long safeShift(final long unit, final long shift) | |
| toBytes | back to summary |
|---|---|
| public abstract long toBytes(long amount) returns the amount in bytes
| |
| toGigaBytes | back to summary |
|---|---|
| public abstract long toGigaBytes(long amount) returns the amount in gigabytes
| |
| toKiloBytes | back to summary |
|---|---|
| public abstract long toKiloBytes(long amount) returns the amount in kilobytes
| |
| toMegaBytes | back to summary |
|---|---|
| public abstract long toMegaBytes(long amount) returns the amount in megabytes
| |
| toString | back to summary |
|---|---|
| public String toString(final long amount) Human readable value, with the added unit character as a suffix
| |
| valueOf | back to summary |
|---|---|
| public static MemoryUnit valueOf(String name) | |
| values | back to summary |
|---|---|
| public static MemoryUnit[] values() | |