public class BytesSizeFormat extends Object implements DoubleFormat
| Modifier and Type | Field and Description |
|---|---|
static BytesSizeFormat |
INSTANCE |
| Constructor and Description |
|---|
BytesSizeFormat() |
BytesSizeFormat(boolean leadingZeros,
boolean intermediateZeros,
boolean fixedLength,
boolean binaryPrefix,
char high,
char low,
int depth) |
BytesSizeFormat(String format)
Size format is a sequence of commands :
B,K,M,G,T : Show Bytes/Kilo/Mega/Giga/Tera, if this is the first
multiplier it will be considered as the minimum multiplier otherwise it
will be considered as the maximum multiplier
I : binary prefix (use 1024 multipliers)
D : multiplier maximum depth, should be suffixed with an integer (i.e
BTD2 means that if number is in giga will not show further than
kilo)
F : fixed length
Z : if used in the very first position (0) consider leadingZeros, if
at the last position consider trailing zeros if anywhere else consider
intermediateZeros
examples
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(long bytes) |
String |
formatDouble(double value) |
String |
toPattern() |
public static final BytesSizeFormat INSTANCE
public BytesSizeFormat(boolean leadingZeros,
boolean intermediateZeros,
boolean fixedLength,
boolean binaryPrefix,
char high,
char low,
int depth)
public BytesSizeFormat()
public BytesSizeFormat(String format)
System.out.println(new MemorySizeFormatter("0I0BEF0").format(1073741824));
0Ei 0Pi 0Ti 1Gi 0Mi 0Ki
System.out.println(new MemorySizeFormatter("00BEF0").format(1073741824));
0E 0P 0T 1G 73M 741K 824B
System.out.println(new MemorySizeFormatter("B0TD1F").format(1073741824));
1G
System.out.println(new MemorySizeFormatter("B0TD2F").format(1073741824));
1G 73M
System.out.println(new MemorySizeFormatter("B0TD3F").format(1073741824));
1G 73M 741K
System.out.println(new MemorySizeFormatter("B0TD1FI").format(1073741824));
1Gi
System.out.println(new MemorySizeFormatter("B0TD2FI").format(1073741824));
1Gi
System.out.println(new MemorySizeFormatter("B0TD3FI").format(1073741824));
1Gi
System.out.println(new MemorySizeFormatter("0I0BEF0").format(1073741824));
0Ei 0Pi 0Ti 1Gi 0Mi 0Ki
System.out.println(new MemorySizeFormatter("I0BEF").format(1073741824));
1Gi
System.out.println(new MemorySizeFormatter("IBEF").format(1073741824));
1Gi
System.out.println(new MemorySizeFormatter("0IBTF").format(1073741824));
0Ti 1Gi
format - size formatpublic String formatDouble(double value)
formatDouble in interface DoubleFormatpublic String format(long bytes)
public String toPattern()
Copyright © 2022 vpc open source initiative. All rights reserved.