Display binary units in JasperReports human readable

Description

It would be helpful to display binary units in a human readable format.
Example: 110543 Bytes displayed as 108.0 KiB or 110.5 kB

Acceptance / Success Criteria

None

Attachments

1

Lucidchart Diagrams

Activity

Show:

Ronny Trommer January 8, 2011 at 1:22 PM

The class is added to the helper package org.opennms.netmgt.jasper.helper.BinaryCount

Ronny Trommer January 8, 2011 at 1:20 PM

The following patch enhance JasperReports with an additional Helper class to display binary units human readable. A short example how this class works:

BinaryCount bc = new BinaryCount();
System.out.println(bc.humanReadableByte("si", new Double("110543")));

"si" or "SI" means convert based on 1000 (kB)
"binary" or "BINARY" means convert based on 1024 (KiB)

It will also convert into higher units like MiB/MB, GiB/GB etc.

Details

Assignee

Reporter

Tracking Code

ORG

Components

Affects versions

Priority

PagerDuty

Created January 8, 2011 at 1:16 PM
Updated September 21, 2021 at 9:17 PM