blackboard.util
Class UnitUtil

java.lang.Object
  extended by blackboard.util.UnitUtil

public class UnitUtil
extends java.lang.Object

This class contains methods for formatting units (bytes,kilobytes,etc)

Since:
Bb 6.3
Version:
1.0

Constructor Summary
UnitUtil()
           
 
Method Summary
static java.lang.String toKilobytes(long bytes)
          This static method converts the passed in number of bytes into a kilobyte string grouping digits with locale-dependant thousand separator and with "KB" locale-dependant unit at the end.
static java.lang.String toLocalizedInteger(long value)
          This static method converts the passed in number into a localizable representation of an integer, with digit grouping using locale dependant separators.
static java.lang.String toUnitbytes(long bytes)
          Converts the passed in number of bytes into a byte-size string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitUtil

public UnitUtil()
Method Detail

toLocalizedInteger

public static java.lang.String toLocalizedInteger(long value)
This static method converts the passed in number into a localizable representation of an integer, with digit grouping using locale dependant separators.

Parameters:
value - the number to convert to a numeric String.
Returns:
a localized String representing the integer value

toKilobytes

public static java.lang.String toKilobytes(long bytes)
This static method converts the passed in number of bytes into a kilobyte string grouping digits with locale-dependant thousand separator and with "KB" locale-dependant unit at the end.

Parameters:
bytes - the number of bytes to convert to a kilobyte String.
Returns:
a String representing the number of kilobytes that the bytes argument evaluates to, with "KB" appended at the end. If the input value is negative, the string returned will be "? KB".

toUnitbytes

public static java.lang.String toUnitbytes(long bytes)
Converts the passed in number of bytes into a byte-size string. Group digits with locale-dependant thousand separator if needed, but with "KB", or "MB" or "GB" locale-dependant unit at the end, and a limited precision of 4 significant digits.

Parameters:
bytes - the number of bytes to convert to a size String.
Returns:
a String representing the number of kilobytes that the bytes argument evaluates to, with "KB"/"MB"/"GB"/TB" appended at the end. If the input value is negative, the string returned will be "? KB".


Copyright © 2003 Blackboard, Inc. All Rights Reserved.