Class ConvertionUtils

java.lang.Object
com.tridion.util.convertions.ConvertionUtils

public class ConvertionUtils extends Object
This utility/helper class is used with different converters and may produce human readable format for numbers by converting big numbers into small texts, like 112000000000 into '111 Gb'.
  • Method Details

    • convertToString

      public static String convertToString(Convertor convertor, Double number, int blocks, boolean withWhiteSpace)
      Parameters:
      convertor - class which knows how to convert numbers into texts. For instance bytes to human format divides given number on 1024 as many times as possible and according to that generates output.
      number - to be converted into human format/
      blocks - how many blocks should be printed out: for 1: 112 Gb, for 2: 112 Gb 4 Mb, for 3: 112 Gb 4 Mb 122 Kb, etc.
      withWhiteSpace - generates space between number and text, like '112 Mb' or '112Mb'.
      Returns:
      string representing given number to be easely read by human.
    • convertToString

      public static String convertToString(Convertor convertor, Double number, int blocks)