Class sap.ui.core.format.FileSizeFormatModule: sap/ui/core/format/FileSizeFormat

extends Object

The FileSizeFormat is a static class for formatting and parsing numeric file size values according to a set of format options.

Supports the same options as NumberFormat.getFloatInstance For format options which are not specified default values according to the type and locale settings are used.

Supported format options (additional to NumberFormat):

  • binaryFilesize: if true, base 2 is used: 1 Kibibyte = 1024 Byte, ... , otherwise base 10 is used: 1 Kilobyte = 1000 Byte (Default is false)

Constructor Summary
new sap.ui.core.format.FileSizeFormat()Constructor for FileSizeFormat - must not be used: To get a FileSizeFormat instance, please use getInstance.
Method Summary
sap.ui.core.format.FileSizeFormat.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.format.FileSizeFormat with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.format.FileSizeFormat.getInstance(oFormatOptions?, oLocale?)Get an instance of the FileSizeFormat, which can be used for formatting.
sap.ui.core.format.FileSizeFormat.getMetadata()Returns a metadata object for class sap.ui.core.format.FileSizeFormat.
format(oValue)Format a filesize (in bytes) according to the given format options.
parse(sValue)Parse a string which is formatted according to the given format options.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.core.format.FileSizeFormat()
Constructor for FileSizeFormat - must not be used: To get a FileSizeFormat instance, please use getInstance.
Method Detail
sap.ui.core.format.FileSizeFormat.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.format.FileSizeFormat with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.core.format.FileSizeFormat.getInstance(oFormatOptions?, oLocale?): sap.ui.core.format.FileSizeFormat
Get an instance of the FileSizeFormat, which can be used for formatting.

If no locale is given, the currently configured formatLocale will be used.

Parameters:
{object}oFormatOptions? Object which defines the format options
{sap.ui.core.Locale}oLocale? Locale to get the formatter for
Returns:
{sap.ui.core.format.FileSizeFormat} instance of the FileSizeFormat
sap.ui.core.format.FileSizeFormat.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.format.FileSizeFormat.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
format(oValue): string
Format a filesize (in bytes) according to the given format options.
Parameters:
{number|string}oValue the number (or hex string) to format
Returns:
{string} the formatted output value
parse(sValue): number
Parse a string which is formatted according to the given format options.
Parameters:
{string}sValue the string containing a formatted filesize value
Returns:
{number} the parsed value in bytes