Package org.apache.commons.io
This package defines utility classes for working with streams, readers, writers and files. The most commonly used classes are described here:
IOUtils is the most frequently used class. It provides operations to read, write, copy and close streams.
FileUtils provides operations based around the JDK File class. These include reading, writing, copying, comparing and deleting.
FilenameUtils provides utilities based on filenames. This utility class manipulates filenames without using File objects. It aims to simplify the transition between Windows and Unix. Before using this class however, you should consider whether you should be using File objects.
FileSystemUtils allows access to the filing system in ways the JDK does not support. At present this allows you to get the free space on a drive.
EndianUtils swaps data between Big-Endian and Little-Endian formats.
-
ClassDescriptionByte Order Mark (BOM) representation - see
BOMInputStream
.Converts Strings toByteOrder
instances.Charsets required of every implementation of the Java platform.Deprecated.Use IOUtils.Deprecated.Apache Commons IO no longer uses this class.CancelException is thrown in DirectoryWalker to cancel the current processing.Utility code for dealing with different endian systems.Deprecated.Keeps track of files awaiting deletion, and deletes them when an associated marker object is reclaimed by the garbage collector.Inner class which acts as the reference for a file pending deletion.Strategy for deleting files.Force file deletion strategy.Indicates that a file already exists.General file name and file path manipulation utilities.Abstracts an OS' file system details, currently supporting the single use case of converting a file name String to a legal file name withFileSystem.toLegalFileName(String, char)
.Deprecated.As of 2.6 deprecated without replacement.General file manipulation utilities.Dumps data in hexadecimal format.Enumeration of IO case sensitivity.A IOException based on a list of Throwable causes.Deprecated.(since 2.5) useIOException
insteadA IOException associated with a source index.General IO stream manipulation utilities.An Iterator over the lines in aReader
.Enumerates standard line separators:StandardLineSeparator.CR
,StandardLineSeparator.CRLF
,StandardLineSeparator.LF
.Wraps and presents a stream as a closable iterator resource that automatically closes itself when reaching the end of stream.AnIOException
decorator that adds a serializable tag to the wrapped exception.Monitors a thread, interrupting it if it reaches the specified timeout.