Java Format for file sizes?
January 16, 2006 10:21 AM
Subscribe
Are there any Java Format classes for handling file sizes?
This weekend I was doing some Servlet/JSP programming when I caught the l10n bug. I suddenly realized that using the NumberFormat class I can print out "$10.40" for US viewers, "10,40 USD" for French, etc. Awesome, I tought, so I went around and changed other code to do the same (DateFormat et al.).
But I'm stuck with my file size code. I'd like to show "938.4 MB" for US viewers, "938,4 Mo" for French, etc but it doesn't look like Java comes with a class built in. My searches on Google and GNU.org have also yielded nothing.
Given time I could probably write the code on my own. But it seems like a common enough task that someone would have already done it... any help?
posted by sbutler to computers & internet (5 comments total)
posted by delmoi at 10:29 AM on January 16, 2006