com.atlassian.core.util
Class FileSize

java.lang.Object
  extended by com.atlassian.core.util.FileSize

public class FileSize
extends Object

A class that contains utility methods for formatting the size of files into human readable form.


Constructor Summary
FileSize()
           
 
Method Summary
static String format(long filesize)
          Format the size of a file in human readable form.
static String format(Long filesize)
          Convenience method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSize

public FileSize()
Method Detail

format

public static String format(Long filesize)
Convenience method. Calls format(long filesize).

Parameters:
filesize - The size of the file in bytes.
Returns:
The size in human readable form.
See Also:
format(long)

format

public static String format(long filesize)
Format the size of a file in human readable form. Anything less than a kilobyte is presented in kilobytes to one decimal place. Anything between a kilobyte and a megabyte is presented in kilobytes to zero decimal places. Anything greater than one megabyte is presented in megabytes to two decimal places.

eg.

Parameters:
filesize - The size of the file in bytes.
Returns:
The size in human readable form.


Copyright © 2015 Atlassian. All rights reserved.