Package org.nuxeo.common.utils
Class SizeUtils
- java.lang.Object
-
- org.nuxeo.common.utils.SizeUtils
-
public class SizeUtils extends Object
Class containing helpers related to the expression of sizes in bytes, kilobytes, etc.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
parseSizeInBytes(String string)
Returns the number of bytes corresponding to a string expressing a size.
-
-
-
Field Detail
-
KB
public static final long KB
- See Also:
- Constant Field Values
-
MB
public static final long MB
- See Also:
- Constant Field Values
-
GB
public static final long GB
- See Also:
- Constant Field Values
-
TB
public static final long TB
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseSizeInBytes
public static long parseSizeInBytes(String string) throws NumberFormatException
Returns the number of bytes corresponding to a string expressing a size.The suffixes KB, MB, GB, TB are recognized (in any case).
- Parameters:
string
- the size as a string- Returns:
- the size
- Throws:
NumberFormatException
- if the size cannot be parsed
-
-