public static class ByteSizeStrings.Builder
extends java.lang.Object
ByteSizeStrings
formatter.Constructor and Description |
---|
ByteSizeStrings.Builder() |
Modifier and Type | Method and Description |
---|---|
ByteSizeStrings.Builder |
addSpace() |
ByteSizeStrings.Builder |
addSpace(boolean addSpace)
Whether to add a space between the value and the unit suffix.
|
ByteSizeStrings |
build()
Returns an immutable
ByteSizeStrings formatter using the builder configuration. |
ByteSizeStrings.Builder |
bytesPerMetricUnit(int bytesPerMetricUnit)
The number of bytes per metric usnit, usually either 1000 or 1024.
|
ByteSizeStrings.Builder |
lowerLimit(int lowerLimit)
Prints using a lower suffix until the size is greater than this limit multiplied
by bytes per metric unit, when the next highest suffix will be used.§
|
ByteSizeStrings.Builder |
maxLen(int maxLen)
The maximum length of the printed number.
|
ByteSizeStrings.Builder |
noSpace() |
ByteSizeStrings.Builder |
precision(int precision)
The number of digits accuracy desired in the printed number.
|
ByteSizeStrings.Builder |
suffixBytes(java.lang.String suffixBytes)
The suffix to use when printing bytes.
|
ByteSizeStrings.Builder |
suffixGiga(java.lang.String suffixGiga)
The suffix to use when printing Gigabytes.
|
ByteSizeStrings.Builder |
suffixKilo(java.lang.String suffixKilo)
The suffix to use when printing Kilobytes.
|
ByteSizeStrings.Builder |
suffixMega(java.lang.String suffixMega)
The suffix to use when printing Megabytes.
|
ByteSizeStrings.Builder |
suffixTera(java.lang.String suffixTera)
The suffix to use when printing Terabytes.
|
public ByteSizeStrings.Builder suffixBytes(java.lang.String suffixBytes)
public ByteSizeStrings.Builder suffixKilo(java.lang.String suffixKilo)
public ByteSizeStrings.Builder suffixMega(java.lang.String suffixMega)
public ByteSizeStrings.Builder suffixGiga(java.lang.String suffixGiga)
public ByteSizeStrings.Builder suffixTera(java.lang.String suffixTera)
public ByteSizeStrings.Builder addSpace(boolean addSpace)
Defaults is true for '5 MiB' output.
public ByteSizeStrings.Builder addSpace()
public ByteSizeStrings.Builder noSpace()
public ByteSizeStrings.Builder bytesPerMetricUnit(int bytesPerMetricUnit)
Used to determine when to use the next suffix string.
public ByteSizeStrings.Builder maxLen(int maxLen)
public ByteSizeStrings.Builder precision(int precision)
public ByteSizeStrings.Builder lowerLimit(int lowerLimit)
If this has the value 5 then sizes up to 5000 will be printed as bytes, and over 5000 as Kilobytes.
public ByteSizeStrings build()
ByteSizeStrings
formatter using the builder configuration.