SMILA (incubation) API documentation

org.eclipse.smila.jobmanager.util
Class DataSizeParser

java.lang.Object
  extended by org.eclipse.smila.jobmanager.util.DataSizeParser

public final class DataSizeParser
extends java.lang.Object

parses strings describing data sizes to a long giving the number of bytes specified.


Method Summary
static long parse(java.lang.String dataSize)
          calls parse(String, long) with defaultSize 0.
static long parse(java.lang.String dataSize, long defaultSize)
          parse data size and return number of bytes described by the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static long parse(java.lang.String dataSize,
                         long defaultSize)
parse data size and return number of bytes described by the string. The string contains either a simple long value giving the number of bytes immediately, or a double value with a single character suffix specifying the magnitude. Supported suffixes and their meaning are: E.g., "200m" would be 200 mebibyte, "1.5g" would be 1.5 gibibyte. Suffixes can be in upper case, too. If the input string is empty, the defaultSize value is returned. If the string contains an unsupported suffix, an IllegalArgumentException is thrown. If the number part cannot be parsed, a NumberFormatException is thrown.

Parameters:
dataSize - string in described format
defaultSize - value to return, if dataSize is null or an empty string.
Returns:
number of bytes described by the string.

parse

public static long parse(java.lang.String dataSize)
calls parse(String, long) with defaultSize 0.

Parameters:
dataSize - string in described format
Returns:
number of bytes described by the string.

SMILA (incubation) API documentation