net.larsan.urd.util
Class Sizes
java.lang.Object
|
+--net.larsan.urd.util.Sizes
- public class Sizes
- extends java.lang.Object
A simple class with static parse methods for norna configuration
sizes. The norna sizes follows the follosing pattern: 'amounttoken'
where token is one of the following:
b = byte
kb = kilobyte
m = megabyte
g = gigabyte
So that '7M' would be seven megabyte and '16b' would be 16 bytes.
This class handles floating points so '1.6m' equals 1,6 megabytes.
- Version:
- Alpha-0.1 / 2002-10-06 21:37
- Author:
- Lars J. Nilsson
|
Method Summary |
static long |
toBytes(java.lang.String size)
Get raw byte size from a size string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
toBytes
public static long toBytes(java.lang.String size)
throws java.lang.NumberFormatException
- Get raw byte size from a size string. This throws an
number format exception if the string is malformed.
- Parameters:
size - String size to parse
- Returns:
- The byte size of the parsed string
- Throws:
java.lang.NumberFormatException - If the string is malformed