Click or drag to resize

XmlHelperParseMemorySize Method (String, Int32)

Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
14c (14.1.1.0)
F23534-02
Parse the given string representation of a number of bytes.

Namespace:  Tangosol.Run.Xml
Assembly:  Coherence (in Coherence.dll) Version: 14.1.1.14 (14.1.1.14)
Syntax
C#
public static long ParseMemorySize(
	string s,
	int defaultPower
)

Parameters

s
Type: SystemString
A string with the format [\d]+[[.][\d]+]?[K|k|M|m|G|g|T|t]?[B|b]?
defaultPower
Type: SystemInt32
The exponent used to calculate the factor used in the conversion if one is not implied by the given string.

Return Value

Type: Int64
The number of bytes represented by the given string.
Remarks
The supplied string must be in the format:

[\d]+[[.][\d]+]?[K|k|M|m|G|g|T|t]?[B|b]?

where the first non-digit (from left to right) indicates the factor with which the preceeding decimal value should be multiplied:

  • K or k (kilo, 210)
  • M or m (mega, 220)
  • G or g (giga, 230)
  • T or t (tera, 240)

If the string value does not contain an explict or implicit factor, a factor calculated by raising 2 to the given default power is used. The default power can be one of:

The optional last character B or b indicates a unit of bytes.

See Also