Package net.thevpc.common.util
Class BytesSizeFormat
java.lang.Object
net.thevpc.common.util.BytesSizeFormat
- All Implemented Interfaces:
Serializable,DoubleFormat
Created by vpc on 3/20/17.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBytesSizeFormat(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 -
Method Summary
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
BytesSizeFormat
public BytesSizeFormat(boolean leadingZeros, boolean intermediateZeros, boolean fixedLength, boolean binaryPrefix, char high, char low, int depth) -
BytesSizeFormat
public BytesSizeFormat() -
BytesSizeFormat
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
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- Parameters:
format- size format
-
-
Method Details
-
formatDouble
- Specified by:
formatDoublein interfaceDoubleFormat
-
format
-
toPattern
-