ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kev Jackson <>
Subject [patch] NioFileUtils, Java6FileUtils, FileUtilsAdapter + factory, build.xml (was Re: AW: Adding a methof to StringUtils)
Date Fri, 21 Apr 2006 04:41:24 GMT
Ok, this is what I've managed to bash together this morning:

- NioFileUtils (uses Java1.4 NIO libraries, altered the TRANSFER_SIZE as 
suggested to 32000, currently no way to override that (yet))
- Java6FileUtils (currently has no implementation, but could be used in 
future for implementing Java6 features (file permisions etc))
- FileUtils (refactored to imlement interface, still needs to have all 
comments refactored into @see -> interface)
- FileUtilsAdapter (interface of FileUtils)
- FileUtilsFactory (uses runtime class-loading to select correct 
version, also allows for selection of impl via system property or ant 
property (project.getProperty), as suggested, caches the instance of the 
FileUtilsAdapter on first use.  This assumes that during a build a user 
won't want to swap out FilUtils implementations.)
- build.xml (contains the selector code for [Nio|Java6]FileUtils)

Current problems:
I cannot get the current code to select the implementation based on the 
property I'm specifying - (I'm using and I've also tried 
-D style props).  Any hint as to how this mechanism works in general 
would be appreciated.
Code is just in util package, it would be nicer in it's own separate 
package - open to suggestions on this.
Not sure that the selector in the build is working - after bootstrap + 
build, the ant-nodeps.jar doesn't contain the Nio or the Java6FileUtils 
- should they be here?

Patch attached for consideration and comments.

Btw, swapping to NIO does help the AppFuse build to get past the copying 
- it now fails on HtmlUnit - which we can't do much about.  So 
(anecdotally anyway), NIO seems to use less memory than traditional IO.


View raw message