Treeviz 0.37 2010-10-17

ch.randelshofer.util
Class SizeFormat

java.lang.Object
  extended by ch.randelshofer.util.SizeFormat

public class SizeFormat
extends java.lang.Object

Formats size units into a human readable string.

Version:
1.0 2010-06-20 Created.
Author:
Werner Randelshofer

Constructor Summary
SizeFormat()
           
 
Method Summary
 java.lang.String format(long w)
          Returns a medium version of the formatted string.
static SizeFormat getInstance()
           
 boolean isMebibyte()
           
 void setAlwaysIncludeBytes(boolean newValue)
           
 void setMaximumFractionDigits(int newValue)
           
 void setMebibyte(boolean isMebibyte)
           
 void setShortFormat(boolean newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeFormat

public SizeFormat()
Method Detail

setMaximumFractionDigits

public void setMaximumFractionDigits(int newValue)

setAlwaysIncludeBytes

public void setAlwaysIncludeBytes(boolean newValue)

setShortFormat

public void setShortFormat(boolean newValue)

setMebibyte

public void setMebibyte(boolean isMebibyte)

isMebibyte

public boolean isMebibyte()

format

public java.lang.String format(long w)
Returns a medium version of the formatted string.

Parameters:
w - Units in bytes.
Returns:
Formatted string.

getInstance

public static SizeFormat getInstance()

Copyright 2007-2008 (c) Werner Randelshofer.
All rights reserved.