commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fzli...@omnytex.com
Subject Re: [io] Submission: Commons IO GetFreeSpace
Date Thu, 23 Dec 2004 17:57:20 GMT
Sorry about not prefixing... I'm frankly a bit new to the whole contributing process, it didn't
occur to me that the list was for all commons projects (should have, it's obvious now!).

I did actually face this situation once.  I frankly don't remember the exact reason the information
was needed, but it was a webapp where we needed to know the free space on a volume.  We were
in a state of flux as far as what platform and app server it would be running on, so I didn't
want to use anything "native" in the solution.  I found a spattering of answers for various
OS's, so I thought something like this that could work on all systems might be a nice thing
for people to have.  In the end it's more or less just combining various solutions and abstracting
them somewhat so the caller doesn't care what OS it's on or how to do it on any given OS.

I'd certainly have no objection to where you think it should be put... I looked through all
the commons projects and IO seemed the best fit.  I can't imagine it fits anywhere any better.
 FileSystemUtils sounds like a perfectly reasonable place to me.  If you do decide to add
it, just let me know what I need to do to help and I will do so.  Like I said, I am knew to
contributing :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, December 23, 2004 12:49 pm, Stephen Colebourne said:
> Prefixing by [io] would help......
> 
> This is quite a clever solution to this problem, especially not using any
> native code.
> 
> I am of mixed views as to whether to add it to [io] however. My question
> would be as to why you would need to know this information. What is a real
> use case (as I've never faced one).
> 
> If we did add it , it would have to be a FileSystemUtils.
> 
> Stephen
> 
> 
> ----- Original Message -----
> From: <fzlists@omnytex.com>
>> Please download package at
>> http://www.omnytex.com/commons-io-getfreespace.zip
>>
>> I submit this here for consideration of being added to Commons IO.  If
>> this should be directed elsewhere, I would appreciate that information.
>> Thanks for your time!
>>
>> Synopsis
>> --------
>> A common question I've seen asked (and been asked myself numerous
>> times) is how to get the free space on a volume in a pure-Java way.
>> At the present time, as far as I know, nothing like this exists
>> in the SDKs.  So, I set out to write a class that could do it
>> for any platform (almost) without using JNI.  It's still not really
>> a pure-Java solution since it uses System.exec to shell out to an
>> OS-specific utility (dir for Windows, df for *nix) to get the
>> information.
>>
>> I have tested this on Windows XP, Windows 2000, Windows NT,
>> RedHat Linux and Mandrake Linux.  I believe it will work on
>> virtually any Windows or *nix platform, although the more
>> verification of this I can get, the better!
>>
>> I have purposely left out support for some platforms like AS/400
>> and OS/390 because I frankly don't know anything about them and
>> don't have access to them to test.  Perhaps down down...
>>
>> To use it, simply instantiate a GetFreeSpace object and call the
>> GetFreeSpace() method, passing it a path.  This will be a drive
>> letter, including the colon, on Windows, or a mounted filesystem
>> on *nix.  An IOEXception is thrown if anything goes wrong, with
>> an at least somewhat descriptive message about what may have
>> gone wrong.  Generally-speaking, if used as specified, it should
>> "just work".  (Does it make more sense to make this a static method
>> of some other Commons object?  Anyone?)
>>
>>
> 
> 
> --------------------------------------------------------------------------------
> 
> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 


Mime
View raw message