From bfbbaa4e458735b6410c686a806c512f6fac7e2a Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 01 Jun 2007 11:05:50 +0000
Subject: [PATCH] Add a new method for retrieving the "best-fit" size unit appropriate for a given number of bytes. This is intended for use in user interfaces since the value returned maybe a floating point value and subject to small errors. For LDAP encoding/decoding we still have the original getBestFitUnit() method but it has been renamed to getBestFitUnitExact(). Both methods are class methods.
---
opends/src/server/org/opends/server/admin/SizePropertyDefinition.java | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java b/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
index e9d89b7..f30bca0 100644
--- a/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
@@ -312,9 +312,10 @@
return UNLIMITED;
}
}
+
// Encode the size value using the best-fit unit.
StringBuilder builder = new StringBuilder();
- SizeUnit unit = SizeUnit.BYTES.getBestFitUnit(value);
+ SizeUnit unit = SizeUnit.getBestFitUnitExact(value);
// Cast to a long to remove fractional part (which should not be there
// anyway as the best-fit unit should result in an exact conversion).
--
Gitblit v1.10.0