Quantcast
Channel: Planet Apache
Viewing all articles
Browse latest Browse all 9364

Niall Pemberton: Commons IO 2.0 Released

$
0
0

The Apache Commons team has announced the release of Commons IO 2.0 which can be downloaded here.

Commons IO is a library that contains utility classes, stream implementations, file filters, file comparators and components for dealing with IO operations. The release notes contains the  full details of the enhancements and bug fixes in IO 2.0, but below is a summary of whats new:

Java 5

Commons IO 2.0 has moved to JDK 1.5 allowing improvements both internally and in the external API. Except for the new minimum JDK requirement, however, it is otherwise backwards compatible with the previous release, which required JDK 1.3.

Streams, Readers & Writers

There are a number of new InputStream / Reader and OutputStream / Writer implementations in IO 2.0:

As well as these new streams the Proxy InputStream, OutputStream, Reader & Writer implementations have had exception handling and pre/post processing support added.

File Alteration Monitor

The File Alteration Monitor is a component for monitoring file system events (directory and file create, update and delete events). It originated in the JCI FAM module but has been refactored to improve performance and allow selective monitoring of the file system using filters. See the FileAlterationObserver JavaDocs for examples of how to use this component.

Tailer

The Tailer component is a simple implementation of the unix "tail -f" functionality. Register a TailerListener implementation to be notified of new lines in a file.

Utilities

    • New Closeable and Socket flavour implementations of the closeQuietly() method
    • New skipFully() methods for InputStreams and Readers
    • A new toBufferedInputStream() method that avoids unnecessary array allocation/copy
    • A new isSymlink() method to detect sym links
    • A new sizeOf(File) method which, if the file is a directory, sums the sizes of the files recursively
    • New methods for getting the system's home directory file or path
    • New methods for getting the system's temporary directory file or path
    • New flavours of the normalize() and normalizeNoEndSeparator() methods where the separator can be specified
    • New implementation of the freeSpaceKb() method that has no arguments
    • New implementations of the freeSpaceKb() methods that take a timeout parameter

Comparators

File Filters


Viewing all articles
Browse latest Browse all 9364

Trending Articles