or double precision floating point values like megabytes(3.2):
In the case of bytes(double), the value will be rounded off to the nearest integer byte count using Math.round().
The precise number of bytes in a Bytes object can be retrieved by calling bytes(). Approximate values for different units can be retrieved as double precision values using these methods:
Also, value objects can be constructed from strings, optionally using a Locale with valueOf(String) and valueOf(String,Locale). The string may contain a decimal or floating point number followed by optional whitespace followed by a unit (nothing for bytes, K for kilobyte, M for megabytes, G for gigabytes or T for terabytes) optionally followed by a B (for bytes). Any of these letters can be any case. So, examples of permissible string values are:
Note that if the Locale was not US, the values might substitute "," for "." as that is the custom in Euroland.
The toString() and toString(Locale) methods are smart enough to convert a given value object to the most appropriate units for the given value. @author Jonathan Locke
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|