Class StorageUnitConverter

java.lang.Object
org.pentaho.di.core.util.StorageUnitConverter

public class StorageUnitConverter extends Object
  • Constructor Details

    • StorageUnitConverter

      public StorageUnitConverter()
  • Method Details

    • byteCountToDisplaySize

      public String byteCountToDisplaySize(long byteCount)
      Converts byte count to the human readable representation. The size is rounded to nearest X-byte.

      For example: 13.1MB in byte count will return 13MB and 13.9MB in byte count wil return 13MB.

      Supported types: EB, PB, TB, GB, MB, KB or B (for bytes).

      Parameters:
      byteCount -
      Returns:
      human reabable display size
    • displaySizeToByteCount

      public long displaySizeToByteCount(String displaySize)
      Convert human human readable file size format to byte equivalent.

      Accepted units:

      • B - Bytes
      • KB - Kilobytes
      • MB - Megabytes
      • GB - Gigabytes
      Example display sizes:
      "5MB"
      "123B"
      "1.5GB"
      "1,5GB"
      Parameters:
      displaySize - human readable size format
      Returns:
      total number of bytes