org.apache.commons.io

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » Library » apache commons io 1.4 » org.apache.commons.io 
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.

Java Source File NameTypeComment
AllIOTestSuite.javaClass A basic test suite that tests all the IO component.
CopyUtils.javaClass This class provides static utility methods for buffered copying between sources (InputStream, Reader, String and byte[]) and destinations (OutputStream, Writer, String and byte[]).

Unless otherwise noted, these copy methods do not flush or close the streams.

CopyUtilsTest.javaClass JUnit tests for CopyUtils.
DemuxTestCase.javaClass Basic unit tests for the multiplexing streams.
DirectoryWalker.javaClass Abstract class that walks through a directory hierarchy and provides subclasses with convenient hooks to add specific behaviour.

This class operates with a FileFilter and maximum depth to limit the files and direcories visited. Commons IO supplies many common filter implementations in the filefilter package.

The following sections describe:

DirectoryWalkerTestCase.javaClass This is used to test DirectoryWalker for correctness.
EndianUtils.javaClass Utility code for dealing with different endian systems.

Different computer architectures adopt different conventions for byte ordering.

EndianUtilsTest.javaClass
FileCleaner.javaClass Keeps track of files awaiting deletion, and deletes them when an associated marker object is reclaimed by the garbage collector.

This utility creates a background thread to handle file deletion. Each file to be deleted is registered with a handler object. When the handler object is garbage collected, the file is deleted.

In an environment with multiple class loaders (a servlet container, for example), you should consider stopping the background thread if it is no longer needed.

FileCleanerTestCase.javaClass This is used to test FileCleaner for correctness.
FileCleaningTracker.javaClass Keeps track of files awaiting deletion, and deletes them when an associated marker object is reclaimed by the garbage collector.

This utility creates a background thread to handle file deletion. Each file to be deleted is registered with a handler object. When the handler object is garbage collected, the file is deleted.

In an environment with multiple class loaders (a servlet container, for example), you should consider stopping the background thread if it is no longer needed.

FileCleaningTrackerTestCase.javaClass This is used to test FileCleaningTracker for correctness.
FileDeleteStrategy.javaClass Strategy for deleting files.
FileDeleteStrategyTestCase.javaClass Test for FileDeleteStrategy.
FilenameUtils.javaClass General filename and filepath manipulation utilities.

When dealing with filenames you can hit problems when moving from a Windows based development machine to a Unix based production machine. This class aims to help avoid those problems.

NOTE: You may be able to avoid using this class entirely simply by using JDK java.io.File File objects and the two argument constructor java.io.File.File(java.io.Filejava.lang.String) File(File,String) .

Most methods on this class are designed to work the same on both Unix and Windows. Those that don't include 'System', 'Unix' or 'Windows' in their name.

Most methods recognise both separators (forward and back), and both sets of prefixes.

FilenameUtilsTestCase.javaClass This is used to test FilenameUtils for correctness.
FilenameUtilsWildcardTestCase.javaClass
FileSystemUtils.javaClass General File System utilities.

This class provides static utility methods for general file system functions not provided via the JDK java.io.File File class.

The current functions provided are:

  • Get the free space on a drive

author:
   Frank W.
FileSystemUtilsTestCase.javaClass This is used to test FileSystemUtils.
FileUtils.javaClass General file manipulation utilities.

Facilities are provided in the following areas:

  • writing to a file
  • reading from a file
  • make a directory including parent directories
  • copying files and directories
  • deleting files and directories
  • converting to and from a URL
  • listing files and directories by filter and extension
  • comparing file content
  • file last changed date
  • calculating a checksum

Origin of code: Excalibur, Alexandria, Commons-Utils
author:
   Kevin A.

FileUtilsCleanDirectoryTestCase.javaClass Test cases for FileUtils.cleanDirectory() method.
FileUtilsFileNewerTestCase.javaClass This is used to test FileUtils for correctness.
FileUtilsListFilesTestCase.javaClass Test cases for FileUtils.listFiles() methods.
FileUtilsTestCase.javaClass This is used to test FileUtils for correctness.
FileUtilsWaitForTestCase.javaClass This is used to test FileUtils.waitFor() method for correctness.
HexDump.javaClass Dumps data in hexadecimal format.
HexDumpTest.javaClass
IOCase.javaClass Enumeration of IO case sensitivity.

Different filing systems have different rules for case-sensitivity. Windows is case-insensitive, Unix is case-sensitive.

This class captures that difference, providing an enumeration to control how filename comparisons should be performed.

IOCaseTestCase.javaClass This is used to test IOCase for correctness.
IOExceptionWithCause.javaClass Subclasses IOException with the Throwable constructors missing before Java 6.
IOExceptionWithCauseTestCase.javaClass
IOUtils.javaClass General IO stream manipulation utilities.

This class provides static utility methods for input/output operations.

  • closeQuietly - these methods close a stream ignoring nulls and exceptions
  • toXxx/read - these methods read data from a stream
  • write - these methods write data to a stream
  • copy - these methods copy all the data from one stream to another
  • contentEquals - these methods compare the content of two streams

The byte-to-char methods and char-to-byte methods involve a conversion step. Two methods are provided in each case, one that uses the platform default encoding and the other which allows you to specify an encoding.

IOUtilsCopyTestCase.javaClass JUnit tests for IOUtils copy methods.
IOUtilsTestCase.javaClass This is used to test IOUtils for correctness.
IOUtilsWriteTestCase.javaClass JUnit tests for IOUtils write methods.
LineIterator.javaClass An Iterator over the lines in a Reader.

LineIterator holds a reference to an open Reader. When you have finished with the iterator you should close the reader to free internal resources.

LineIteratorTestCase.javaClass This is used to test LineIterator for correctness.
PackageTestSuite.javaClass A basic test suite that tests all the IO package.
w__w_w.ja__v__a2s_.co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.