Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 6 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Mustang: Find Disk Space With New File Methods

At 11:12 PM on Jul 12, 2005, R.J. Lorimer wrote:

Mustang is the codename for the next release of Java (Java 6, Java SE 6, JSE 6, whatever you want to call it), and is currently in early adoption ( Mustang.dev.java.net ). This effectively means that while it isn't released, you can start to play with the details in Mustang, and, within care and reason, start to consider them for your product that may be based on Java SE 6. I would recommend downloading a snapshot of Mustang, and trying your favorite Java applications on it, just to get a feel for what is coming. As most of you probably know, I am a glutton for punishment, and I'm never satisfied with the current state of affairs. So, instead, I have to download unfinished code, and extol the virtues of that which we as-of-yet don't have. Mustang is a veritable goldmine of unfinished 'latest-and-greatest' features. Now, this sounds silly, childish, and at least somewhat related to a mental disorder - but you know you all do it from time to time - and you know want to keep reading, and join me on this path of self indulgence.

One feature that developers have asked for again and again over the course of more than 8 years (697 votes is quite a few), yet Java has never had, is a facility for determining disk/partition size and availability. Up until now, there has been no way to determine the free/used space on a partition using Java. Mustang, however, now has preliminary support built in.

Here is a sample of how to use these methods (on Windows):

File f = new File("c:/");
// prints the volume size in bytes.
System.out.println(f.getTotalSpace());
// prints the total free bytes for the volume in bytes.
System.out.println(f.getFreeSpace());
// prints an accurate estimate of the total free (and available) bytes 
// on the volume. This method may return the same result as 'getFreeSpace()' on 
// some platforms.
System.out.println(f.getUsableSpace());	

From what I have seen, you should take care that the file object these methods are called on represents a partition or volume - otherwise the value returned could be 0. Also, be aware that these methods (although not very likely) have the potential to change - Mustang is not finished yet, and until it is, any new API is fair game to be changed, swapped, altered, poked, prodded, and set on fire. You have been warned - now go have fun with it.

Until next time,

R.J. Lorimer
Contributing Editor - rj -at- javalobby.org
Author              - http://www.coffee-bytes.com
Software Consultant - http://www.crosslogic.com

1 . At 2:48 AM on Jul 13, 2005, Chris Kelly wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

I've had that capability in JConfig since the last century. Good to know Pure Java is finally catching up.
3 . At 3:32 PM on Jul 13, 2005, Gregory Pierce DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

I had never seen this piece of software before. Thank you for posting it. Looks interesting.
4 . At 8:47 PM on Jul 13, 2005, ahmet akin wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

what i am really wondering is, what was the thing people are underestimating on this fix? obviously there was something challenging made this that late. disk quotas? OS did not have the utility? Anybody knows the internals of this?
5 . At 9:23 AM on Jul 14, 2005, R.J. Lorimer wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

That's a very good question; had me wondering too. From the bug report:

Resolution of this request is considered a high priority for Mustang.
Active development on this feature has been in progress for the past
several months. I expect that we will complete this work within the
next couple of months. These methods will be in Mustang-beta.

That sounds a lot like it took several months to develop the implementation. Maybe some of the less common platforms were harder to provide support for.... I don't know.
Best, R.J. Lorimer
6 . At 12:50 AM on Dec 12, 2007, ravi wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

Hi

This is the great feature actually.Can you suggest me any API is available in java1.6 to find out the CPU Utilization and Memory Usage too.

Thanks in Advance.







Regards
Ravi Kumar Vanama
7 . At 8:57 PM on Jan 28, 2008, ABBEY wrote:
  Click to reply to this thread Reply

Re: Mustang: Find Disk Space With New File Methods

Cool, master a tip today.
Java Forum

thread.rss_message