| Interface | Description |
|---|---|
| Messages |
The internationalization constants used by this package.
|
| SpecialNames |
Special names used to denote standard streams or operations on
regular files.
|
| Class | Description |
|---|---|
| CloseableRegistry |
A registry of
Closeable instances. |
| CopyBytesUtils |
Utilities for copying binary data.
|
| CopyCharsUnicodeUtils |
Utilities for copying textual data, with Unicode BOM support.
|
| CopyCharsUtils |
Utilities for copying textual data, in the default JVM charset.
|
| Deleter |
Deletes a file or directory recursively.
|
| InputStreamWrapper |
A wrapped input stream.
|
| OutputStreamWrapper |
A wrapped output stream.
|
| ReaderWrapper |
A wrapped reader.
|
| SmartLinksDirectoryWalker |
A
DirectoryWalker which provides convenience methods to
initiate traversal, and (optionally) does not follow symbolic
links. |
| WriterWrapper |
A wrapped writer.
|
| Enum | Description |
|---|---|
| FileType |
A file type.
|
Miscellaneous utilities for file management.
This package complements the standard Java file handling facilities
and apache's IOUtils. These include:
The CopyBytesUtils, CopyCharsUtils, and CopyCharsUnicodeUtils classes provide
utilities for copying data between files, streams, and memory, in
various combinations.
FileType offers symbolic
link detection and file typing, in the minimal fashion possible within
the platform-independent Java.
SmartLinksDirectoryWalker
offers recursive file tree traversal and Deleter offers tree deletion; both are
sensitive to symbolic links.
In addition to utilities, the package makes available a recommended
design pattern for handling streams safely via the supporting class
CloseableRegistry. When a series of
streams need to be opened and eventually closed, it is important that
such closures takes place in a timely fashion via explicit calls
to close(). This must happen even if an exception
interrupts normal processing, to ensure that the operating system does
not maintain locks on unused files or uses up file descriptors. Here
is the recommended approach for handling stream closure:
CloseableRegistry r=new CloseableRegistry();
try {
ByteArrayOutputStream byteArray=new ByteArrayOutputStream();
r.register(byteArray);
PrintStream printStream=new PrintStream(byteArray);
r.register(printStream);
... use printStream
} finally {
r.close();
}
Many of the above utilities recognize sentinel values as input or
output file names, such as :stdin: for standard input;
the complete set of such special names is the constants of SpecialNames.
Copyright © 2015. All Rights Reserved.