org.apache.commons.io

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » apache common IO » 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.
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.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.