commons-io-2.11.0-src/CONTRIBUTING.md 0100644 0000000 0000000 00000014565 13612062727 017251 0 ustar 00root root 0000000 0000000
Contributing to Apache Commons IO
======================
You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to
the open source community. Before you dig right into the code there are a few guidelines that we need contributors to
follow so that we can have a chance of keeping on top of things.
Getting Started
---------------
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons IO's scope.
+ Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
+ Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-),
[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository.
Making Changes
--------------
+ Create a _topic branch_ for your isolated work.
* Usually you should base your branch on the `master` or `trunk` branch.
* A good topic branch name can be the JIRA bug id plus a keyword, e.g. `IO-123-InputStream`.
* If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
+ Make commits of logical units.
* Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
* e.g. `IO-123: Close input stream earlier`
+ Respect the original code style:
+ Only use spaces for indentation.
+ Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
+ Check for unnecessary whitespace with `git diff` -- check before committing.
+ Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
The JIRA tickets are used to generate the changelog for the next release.
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
Submitting Changes
------------------
+ Sign and submit the Apache [Contributor License Agreement][cla] if you haven't already.
* Note that small patches & typical bug fixes do not require a CLA as
clause 5 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html#contributions)
covers them.
+ Push your changes to a topic branch in your fork of the repository.
+ Submit a _Pull Request_ to the corresponding repository in the `apache` organization.
* Verify _Files Changed_ shows only your intended changes and does not
include additional files like `target/*.class`
+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you prefer to not use GitHub, then you can instead use
`git format-patch` (or `svn diff`) and attach the patch file to the JIRA issue.
Additional Resources
--------------------
+ [Contributing patches](https://commons.apache.org/patches.html)
+ [Apache Commons IO JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ `#apache-commons` IRC channel on `irc.freenode.net`
[cla]:https://www.apache.org/licenses/#clas
[jira]:https://issues.apache.org/jira/browse/IO
commons-io-2.11.0-src/LICENSE.txt 0100644 0000000 0000000 00000026137 13612062727 016641 0 ustar 00root root 0000000 0000000
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
commons-io-2.11.0-src/NOTICE.txt 0100644 0000000 0000000 00000000254 13612062727 016530 0 ustar 00root root 0000000 0000000 Apache Commons IO
Copyright 2002-2021 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).
commons-io-2.11.0-src/PROPOSAL.html 0100644 0000000 0000000 00000005753 13612062727 017144 0 ustar 00root root 0000000 0000000
Proposal for IO Package
Proposal for IO Package
(0) Rationale
Many software projects have a need to perform I/O in various ways, and
the JDK class libraries provide a lot of functionality, but sometimes you
need just a little bit more. The io package seeks to encapsulate some of
the most popular i/o base classes into one easy to use package.
(1) Scope of the Package
This proposal is to create a package of Java utility classes for various
types of i/o related activity.
(1.5) Interaction With Other Packages
IO relies only on standard JDK 1.2 (or later) APIs for production
deployment. It utilizes the JUnit unit testing framework for developing
and executing unit tests, but this is of interest only to developers of the
component. IO will be a dependency for several existing components in the
open source world.
No external configuration files are utilized.
(2) Initial Source of the Package
The original Java classes are splashed around various Apache subprojects.
We intend to seek them out and integrate them.
The proposed package name for the new component is org.apache.commons.io.
(3) Required Jakarta-Commons Resources
CVS Repository - New directory io in the jakarta-commons
CVS repository.
Mailing List - Discussions will take place on the general dev@commons.apache.org
mailing list. To help list subscribers identify messages of interest,
it is suggested that the message subject of messages about this component
be prefixed with [IO].
Bugzilla - New component "IO" under the "Commons" product category,
with appropriate version identifiers as needed.
Jyve FAQ - New category "commons-io" (when available).
(4) Initial Committers
The initial committers on the IO component shall be Scott Sanders and
Nicola Ken Barozzi and Henri Yandell
commons-io-2.11.0-src/README.md 0100644 0000000 0000000 00000013076 13612062727 016273 0 ustar 00root root 0000000 0000000
Apache Commons IO
===================
[](https://travis-ci.org/apache/commons-io)
[](https://github.com/apache/commons-io/actions)
[](https://coveralls.io/r/apache/commons-io)
[](https://maven-badges.herokuapp.com/maven-central/commons-io/commons-io/)
[](https://javadoc.io/doc/commons-io/commons-io/2.11.0)
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
Documentation
-------------
More information can be found on the [Apache Commons IO homepage](https://commons.apache.org/proper/commons-io).
The [Javadoc](https://commons.apache.org/proper/commons-io/apidocs) can be browsed.
Questions related to the usage of Apache Commons IO should be posted to the [user mailing list][ml].
Where can I get the latest release?
-----------------------------------
You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-io/download_io.cgi).
Alternatively you can pull it from the central Maven repositories:
```xml
commons-iocommons-io2.11.0
```
Contributing
------------
We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors.
There are some guidelines which will make applying PRs easier for us:
+ No tabs! Please use spaces for indentation.
+ Respect the code style.
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
+ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn clean test```.
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas).
You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md).
License
-------
This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).
See the `NOTICE.txt` file for required notices and attributions.
Donations
---------
You like Apache Commons IO? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development.
Additional Resources
--------------------
+ [Apache Commons Homepage](https://commons.apache.org/)
+ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/IO)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ `#apache-commons` IRC channel on `irc.freenode.org`
[ml]:https://commons.apache.org/mail-lists.html
commons-io-2.11.0-src/RELEASE-NOTES.txt 0100644 0000000 0000000 00000201613 13612062727 017517 0 ustar 00root root 0000000 0000000 Apache Commons IO
Version 2.11.0
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
==============================================================================
Apache Commons IO Version 2.11.0
==============================================================================
Java 8 required.
Changes in this version include:
Fixed Bugs:
o IO-741: FileUtils.listFiles does not list matching files if File parameter is a symbolic link. Thanks to Zach Sherman.
o IO-724: FileUtils#deleteDirectory(File) exception Javadoc inaccurate update #245. Thanks to liran2000.
o Minor changes #243. Thanks to Arturo Bernal.
o Replace construction of FileInputStream and FileOutputStream objects with Files NIO APIs. #221. Thanks to Arturo Bernal.
o Fix IndexOutOfBoundsException in IOExceptionList constructors. Thanks to Gary Gregory.
o Remove IOException from the method signatures that no longer throw IOException.
This maintains binary compatibility but not source compatibility.
- FilenameUtils
directoryContains(String, String)
- BoundedReader
BoundedReader(java.io.Reader, int)
- IOUtils
lineIterator(java.io.InputStream, Charset)
lineIterator(java.io.InputStream, String)
toByteArray(String)
toInputStream(CharSequence, String)
toInputStream(String, String)
toString(byte[])
toString(byte[], String) Thanks to Gary Gregory.
Changes:
o Add SymbolicLinkFileFilter. Thanks to Gary Gregory.
o Add test to make sure the setter of AndFileFilter works correctly #244. Thanks to trncate.
o Add XmlStreamReader(Path). Thanks to Gary Gregory.
o Bump mockito-inline from 3.11.0 to 3.11.2 #247. Thanks to Dependabot.
o Bump jmh.version from 1.27 to 1.32 #237. Thanks to Dependabot.
o Bump spotbugs from 4.2.3 to 4.3.0 #249. Thanks to Dependabot.
Compatibility with 2.6:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.9.0 requires Java 8.
Commons IO 2.8.0 requires Java 8.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
Apache Commons IO
Version 2.10.0
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
==============================================================================
Apache Commons IO Version 2.10.0
==============================================================================
Java 8 required.
Changes in this version include:
New features:
o Add and use RegexFileFilter.toString(). Thanks to Gary Gregory.
o Add and use RegexFileFilter.RegexFileFilter(Pattern, Function, String>) Thanks to Gary Gregory.
o Add and use IOCase.isCaseSensitive(IOCase). Thanks to Gary Gregory.
Fixed Bugs:
o IO-733: RegexFileFilter uses the path and file name instead of just the file name. Thanks to Jim Sellers, Gary Gregory.
o IO-734: The OSGi manifest now contains sun.* import packages #239. Thanks to Eric Norman.
o IO-585: Sanitize double slash after prefix #79. Thanks to Adam McClenaghan.
Changes:
o Bump actions/cache from 2.1.5 to 2.1.6 #238. Thanks to Dependabot.
o Bump junit-pioneer from 1.4.1 to 1.4.2 #240. Thanks to Dependabot.
o Bump checkstyle from 8.42 to 8.43 #241. Thanks to Dependabot.
o Bump mockito-inline from 3.10.0 to 3.11.0 #242. Thanks to Dependabot.
Compatibility with 2.6:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.9.0 requires Java 8.
Commons IO 2.8.0 requires Java 8.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
Apache Commons IO
Version 2.8.0
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
==============================================================================
Apache Commons IO Version 2.8.0
==============================================================================
Java 8 required.
Changes in this version include:
New features:
o Add org.apache.commons.io.input.CircularInputStream. Thanks to Gary Gregory.
o Add org.apache.commons.io.file.PathUtils.cleanDirectory(Path, FileVisitOption...). Thanks to Gary Gregory.
o Add org.apache.commons.io.file.PathUtils.deleteDirectory(Path, FileVisitOption...). Thanks to Gary Gregory.
o Add NullAppendable. Thanks to Gary Gregory.
o Add PathUtils.getAclEntryList(Path). Thanks to Gary Gregory.
o Null-guard IOUtils.close(Closeable, IOConsumer). Thanks to Gary Gregory.
o Add ReversedLinesFileReader.readLines(int). Thanks to Gary Gregory.
o Add ReversedLinesFileReader.toString(int). Thanks to Gary Gregory.
o IO-684: Add PathUtils.delete(Path, DeleteOption...).
Add PathUtils.deleteDirectory(Path, DeleteOption...).
Add PathUtils.deleteFile(Path, DeleteOption...).
Add PathUtils.setReadOnly(Path, boolean, LinkOption...).
Add CleaningPathVisitor.CleaningPathVisitor(PathCounters, DeleteOption[], String...).
Add DeletingPathVisitor.DeletingPathVisitor(PathCounters, DeleteOption[], String...). Thanks to Gary Gregory, Robin Jansohn.
o Add RandomAccessFileInputStream. Thanks to Gary Gregory.
o IO-681: IOUtils.close(Closeable) should allow a list of closeables.
o Add IOUtils.consume(InputStream). Thanks to Gary Gregory.
o IO-676: Add isFileNewer() and isFileOlder() methods that support the Java 8 Date/Time API. #124. Thanks to Isira Seneviratne, Gary Gregory.
o Add a MarkShieldInputStream #119. Thanks to Adam Retter, Gary Gregory.
o Deprecate IOUtils.LINE_SEPARATOR in favor of Java 7's System.lineSeparator(). Thanks to Gary Gregory.
Fixed Bugs:
o CharSequenceReader.skip should return 0 instead of EOF on stream end #123. Thanks to Rob Spoor, Jochen Wiedmann.
o Implement CharSequenceReader.ready() #122. Thanks to Rob Spoor.
o IO-669: Fix code smells; fix typos #115. Thanks to XenoAmess, Gary Gregory.
o Add caching for required charsets #120. Thanks to Jerome Wolff, Gary Gregory.
o IO-673: Make some simplifications #121. Thanks to Jerome Wolff.
o IO-674: InfiniteCircularInputStream is not infinite if its input buffer contains -1. Thanks to Gary Gregory.
o IO-675: InfiniteCircularInputStream throws a divide-by-zero exception when reading if its input buffer is size 0. Thanks to Gary Gregory.
o IO-677: FileSystem.getCurrent() does not return the correct enum. Thanks to Gary Gregory.
o IO-679: input.AbstractCharacterFilterReader passes count of chars read #132. Thanks to proneel.
o IO-683: CircularBufferInputStream.read() fails to convert byte to unsigned int
o Fix SpotBugs issues in org.apache.commons.io.FileUtils. Thanks to Gary Gregory.
o IO-672: Copying a File sets last modified date to 01 January 1970.
o IO-676: Prevent NullPointerException in ReversedLinesFileReader constructors #117. Thanks to Michael Ernst, Gary Gregory.
Changes:
o Replace FindBugs with SpotBugs. Thanks to Gary Gregory.
o maven-checkstyle-plugin 3.1.0 -> 3.1.1. Thanks to Gary Gregory.
o Update tests from org.apache.commons:commons-lang3 3.10 to 3.11. Thanks to Gary Gregory.
o Update commons-parent from 50 to 51 #129. Thanks to Gary Gregory.
o Update actions/checkout from v1 to v2.3.1 #126. Thanks to Gary Gregory.
o Update junit-pioneer from 0.6.0 to 0.8.0, #127, #135. Thanks to Gary Gregory.
o Update mockito-core from 3.3.3 to 3.5.9 #128, #133, #145, #149, #151. Thanks to Gary Gregory.
o Update spotbugs from 4.0.6 to 4.1.1 #134. Thanks to Dependabot.
o Update junit-pioneer from 0.8.0 to 0.9.0 #138. Thanks to Dependabot.
o Update actions/checkout from v2.3.1 to v2.3.2 #140. Thanks to Dependabot.
o Update actions/setup-java from v1.4.0 to v1.4.2 #141, #148. Thanks to Dependabot.
Compatibility with 2.7:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
==============================================================================
Apache Commons IO
Version 2.7
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
==============================================================================
Apache Commons IO Version 2.7
==============================================================================
Java 8 required.
Changes in this version include:
New features:
o Adding the CircularBufferInputStream, and the PeekableInputStream.
o IO-553: Add org.apache.commons.io.FilenameUtils.isIllegalWindowsFileName(char).
o IO-577: Add readers to filter out given characters: CharacterSetFilterReader and CharacterFilterReader. Thanks to Gary Gregory.
o IO-594: Add IOUtils copy methods with java.lang.Appendable as the target. Thanks to Gary Gregory.
o IO-605: Add class CanExecuteFileFilter. Thanks to Gary Gregory.
o IO-578: Support java.nio.Path and non-default file systems for ReversedLinesFileReader (#62). Thanks to Mark Chesney.
o IO-608: Add a convenience NullPrintStream. Thanks to Gary Gregory.
o IO-612: Add class TeeReader. Thanks to Rob Spoor, Gary Gregory.
o IO-613: Add classes ClosedReader and CloseShieldReader. #84. Thanks to Rob Spoor, Gary Gregory.
o IO-614: Add classes TaggedWriter, ClosedWriter and BrokenWriter. #86. Thanks to Rob Spoor.
o IO-615: Add classes TeeWriter, FilterCollectionWriter, ProxyCollectionWriter, IOExceptionList, IOIndexedException. Thanks to Gary Gregory, Rob Spoor.
o IO-616: Add class AppendableWriter. #87. Thanks to Rob Spoor.
o IO-617: Add class CloseShieldWriter. #83. Thanks to Rob Spoor, Gary Gregory.
o IO-618: Add classes Added TaggedReader, ClosedReader and BrokenReader. #85. Thanks to Rob Spoor.
o IO-619: Support sub sequences in CharSequenceReader. #91. Thanks to Rob Spoor.
o IO-631: Add a CountingFileVisitor (as the basis for a forthcoming DeletingFileVisitor). Thanks to Gary Gregory.
o IO-632: Add PathUtils for operations on NIO Path. Thanks to Gary Gregory.
o IO-633: Add DeletingFileVisitor. Thanks to Gary Gregory.
o IO-635: Add org.apache.commons.io.IOUtils.close(Closeable). Thanks to Gary Gregory.
o IO-636: Add and reuse org.apache.commons.io.IOUtils.closeQuitely(Closeable, Consumer).
Add and reuse org.apache.commons.io.IOUtils.close(Closeable, IOConsumer). Thanks to Gary Gregory.
o IO-645: Add org.apache.commons.io.file.PathUtils.fileContentEquals(Path, Path, OpenOption...). Thanks to Gary Gregory.
o IO-458: Add a SequenceReader similar to java.io.SequenceInputStream. Thanks to Gary Gregory, Joshua Gitlin.
o IO-648: Implement directory content equality. 100#. Thanks to Gary Gregory.
o IO-648: Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108. Thanks to Adam Retter, Alex Herbert, Gary Gregory.
o IO-662: Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108. Thanks to Adam Retter, Gary Gregory.
Fixed Bugs:
o IO-589: Some tests fail if the base path contains a space.
o IO-582: Make methods in ObservableInputStream.Obsever public. Thanks to Bruno Palos.
o IO-535: Thread bug in FileAlterationMonitor.stop(int). Thanks to Svetlin Zarev, Anthony Raymond.
o IO-557: Perform locale independent upper case conversions. Thanks to luccioman.
o IO-570: Missing Javadoc in FilenameUtils causing Travis-CI build to fail. Thanks to Pranet Verma.
o IO-571: Remove redundant isDirectory() check in org.apache.commons.io.FileUtils.listFilesAndDirs(File, IOFileFilter, IOFileFilter). Thanks to pranet.
o IO-559: FilenameUtils.normalize now verifies hostname syntax in UNC path.
o IO-554: FileUtils.copyToFile(InputStream source, File destination) should not close input stream. Thanks to Michele Mariotti.
o IO-604: FileUtils.doCopyFile(File, File, boolean) can throw ClosedByInterruptException. Thanks to Gary Gregory.
o IO-625: Corrected misleading exception message for FileUtils.copyDirectoryToDirectory. Thanks to Mikko Maunu.
o IO-626: A mistake in the FilenameUtils.concat()'s Javadoc about an absolute path. Thanks to Yuji Konishi.
o IO-640: NPE in org.apache.commons.io.IOUtils.contentEquals(InputStream, InputStream) when only one input is null. Thanks to Gary Gregory.
o IO-641: NPE in org.apache.commons.io.IOUtils.contentEquals(Reader, Reader) when only one input is null. Thanks to Gary Gregory.
o IO-643: NPE in org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader) when only one input is null. Thanks to Gary Gregory.
o IO-644: NPE in org.apache.commons.io.FileUtils.contentEqualsIgnoreEOL(File, File) when only one input is null. Thanks to Gary Gregory.
o IO-664: org.apache.commons.io.FileUtils.copyURLToFile(*) open but do not close streams. Thanks to Gary Gregory.
Changes:
o IO-572: Refactor duplicate code in org.apache.commons.io.FileUtils. Thanks to Pranet Verma.
o IO-580: Update org.apache.commons.io.FilenameUtils.isExtension(String, String[]) to use var args.
o IO-701: Make array declaration in ThresholdingOutputStream consistent with other array declarations in the library #77. Thanks to Raymond Tan.
o IO-607: Update from Java 7 to Java 8. Thanks to Gary Gregory.
o IO-610: Remove throws IOException in method isSymlink() #80. Thanks to Sebastian.
o IO-628: Migration to JUnit Jupiter #97. Thanks to Allon Mureinik.
o IO-630: Deprecate org.apache.commons.io.output.NullOutputStream.NullOutputStream() in favor of org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM. Thanks to Gary Gregory.
o IO-629: FileUtils#forceDelete should use Files#delete rather than File#delete so exception messages includes reason for failure. Thanks to Ian Springer, Ian Springer, Gary Gregory.
o IO-634: Make getCause synchronized and use a Deque instead of a Stack #64. Thanks to Vclav Haisman, Bruno P. Kinoshita, Gary Gregory.
o Update tests from Apache Commons Lang 3.9 to 3.10. Thanks to Gary Gregory.
o Update tests org.junit-pioneer:junit-pioneer 0.3.0 -> 0.6.0. Thanks to Gary Gregory.
o Update tests org.junit.jupiter:junit-jupiter 5.5.2 -> 5.6.2. Thanks to Gary Gregory.
o Update tests org.mockito:mockito-core 3.0.0 -> 3.3.3. Thanks to Gary Gregory.
o IO-666: Normalize internal buffers to 8192 bytes. Thanks to Gary Gregory.
o IO-665: Ensure that passing a null InputStream results in NPE with tests #112. Thanks to Otto Fowler, Gary Gregory.
o commons.jacoco.version 0.8.4 -> 0.8.5. Thanks to Gary Gregory.
o com.github.siom79.japicmp:japicmp-maven-plugin 0.14.1 -> 0.14.3. Thanks to Gary Gregory.
o IO-667: Add functional interfaces IOFunction and IOSupplier #110. Thanks to Adam Retter, Gary Gregory.
o Support sub sequences in CharSequenceReader #91. Thanks to Rob Spoor, Gary Gregory.
o Remove deprecated sudo setting. #113. Thanks to dengliming.
Compatibility with 2.6:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
==============================================================================
Apache Commons IO Version 2.6
==============================================================================
INTRODUCTION:
Apache Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations,
file filters, file comparators, endian transformation classes, and much more.
Apache Commons IO 2.6 requires at least Java 7 to build and run.
DEPRECATIONS
============
All closeQuietly overloads in org.apache.commons.io.IOUtils have been
deprecated. Use the try-with-resources statement or handle suppressed
exceptions manually.
The class org.apache.commons.io.FileSystemUtils has been deprecated.
Use equivalent methods in java.nio.file.FileStore instead, e.g.
Files.getFileStore(Paths.get("/home")).getUsableSpace() or iterate over
FileSystems.getDefault().getFileStores().
COMPATIBILITY WITH JAVA 9
==================
The MANIFEST.MF now contains an additional entry:
Automatic-Module-Name: org.apache.commons.io
This should make it possible to use Commons IO 2.6 as a module in the Java 9
module system. For more information see the corresponding issue:
https://issues.apache.org/jira/browse/IO-551
Building Commons IO 2.6 should work out of the box with the latest Java 9
release. Please report any Java 9 related issues at:
https://issues.apache.org/jira/browse/IO
NEW FEATURES
============
o IO-551: Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility.
o IO-367: Add convenience methods for copyToDirectory. Thanks to James Sawle.
o IO-493: Add infinite circular input stream. Thanks to Piotr Turski.
o IO-507: Add a ByteOrderUtils class.
o IO-518: Add ObservableInputStream.
o IO-519: Add MessageDigestCalculatingInputStream.
o IO-513: Add convenience methods for reading class path resources.
Thanks to Behrang Saeedzadeh.
FIXED BUGS
==========
o IO-546: ClosedOutputStream#flush should throw. Thanks to Tomas Celaya.
o IO-550: Documentation issue, fix 404 Javadoc issues in the description page.
Thanks to Jimi Adrian.
o IO-442: Javadoc contradictory for FileFilterUtils.ageFileFilter(cutoff) and
the filter it constructs: AgeFileFilter(cutoff).
Thanks to Simon Robinson.
o IO-534: FileUtilTestCase.testForceDeleteDir() should not delete testDirectory
parent.
o IO-528: Fix Tailer.run race condition runaway logging. Thanks to Dave Moten.
o IO-483: getPrefixLength return -1 if unix file contains colon.
Thanks to Marko Vasic.
o IO-520: FileUtilsTestCase#testContentEqualsIgnoreEOL fails on Windows.
o IO-516: .gitattributes not correctly applied. Thanks to Jason Pyeron.
o IO-515: Allow Specifying Initial Buffer Size of DeferredFileOutputStream.
Thanks to Brett Lounsbury, Gary Gregory.
o IO-512: ThresholdingOutputStream.thresholdReached() results in
FileNotFoundException. Thanks to Ralf Hauser.
o IO-511: After a few unit tests, a few newly created directories not cleaned
completely. Thanks to Ahmet Celik.
o IO-502: Exceptions are suppressed incorrectly when copying files.
Thanks to Christian Schulte.
o IO-503: Update platform requirement to Java 7.
o IO-537: BOMInputStream shouldn't sort array of BOMs in-place.
Thanks to Borys Zibrov.
CHANGES
=======
o IO-553: Make code style of hasBOM() consistent with getBOMCharsetName().
Thanks to Michael Ernst.
o IO-542: FileUtils#readFileToByteArray: optimize reading of files with known
size. Thanks to Ilmars Poikans.
o IO-547: Throw a IllegalArgumentException instead of NullPointerException in
FileSystemUtils.freeSpaceWindows(). Thanks to Nikhil Shinde,
Michael Ernst, Gary Greory.
o IO-506: Deprecate methods FileSystemUtils.freeSpaceKb().
Thanks to Christian Schulte.
o IO-505: Make LineIterator implement Closeable to support try-with-resources
statements. Thanks to Christian Schulte.
o IO-504: Deprecated of all IOUtils.closeQuietly() methods and use
try-with-resources internally. Thanks to Christian Schulte.
REMOVED
=======
o IO-514: Remove org.apache.commons.io.Java7Support.
COMPATIBILITY WITH OLDER VERSIONS
=================================
Compatibility with 2.5:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.6 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in
https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in
https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.6 requires Java 7 or later.
Commons IO 2.5 requires Java 6 or later.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.5
==============================================================================
New features and bug fixes.
Changes in this version include:
New features:
o IO-487: Add ValidatingObjectInputStream for controlled deserialization
o IO-471: Support for additional encodings in ReversedLinesFileReader Thanks to Leandro Reis.
o IO-425: Setter method for threshold on ThresholdingOutputStream Thanks to Craig Swank.
o IO-406: Introduce new class AppendableOutputStream Thanks to Niall Pemberton.
o IO-459: Add WindowsLineEndingInputStream and UnixLineEndingInputStream. Thanks to Kristian Rosenvold.
o IO-457: Add a BoundedReader, a wrapper that can be used to constrain access
to an underlying stream when used with mark/reset -
to avoid overflowing the mark limit of the underlying buffer. Thanks to Kristian Rosenvold.
o IO-426: Add API IOUtils.closeQuietly(Closeable...)
o IO-410: Readfully() That Returns A Byte Array Thanks to Beluga Behr.
o IO-395: Overload IOUtils buffer methods to accept buffer size Thanks to Beluga Behr.
o IO-382: Chunked IO for large arrays.
Added writeChunked(byte[], OutputStream) and writeChunked(char[] Writer)
Added ChunkedOutputStream, ChunkedWriter
o IO-233: Add Methods for Buffering Streams/Writers To IOUtils
Added overloaded buffer() methods - see also IO-330
o IO-330: IOUtils#toBufferedOutputStream/toBufferedWriter to conditionally wrap the output
Added overloaded buffer() methods - see also IO-233
o IO-381: Add FileUtils.copyInputStreamToFile API with option to leave the source open.
See copyInputStreamToFile(final InputStream source, final File destination, boolean closeSource)
o IO-379: CharSequenceInputStream - add tests for available()
Fix code so it really does reflect a minimum available.
o IO-346: Add ByteArrayOutputStream.toInputStream()
o IO-341: A constant for holding the BOM character (U+FEFF)
o IO-361: Add API FileUtils.forceMkdirsParent().
o IO-360: Add API Charsets.requiredCharsets().
o IO-359: Add IOUtils.skip and skipFully(ReadableByteChannel, long). Thanks to yukoba.
o IO-358: Add IOUtils.read and readFully(ReadableByteChannel, ByteBuffer buffer). Thanks to yukoba.
o IO-353: Add API IOUtils.copy(InputStream, OutputStream, int) Thanks to ggregory.
o IO-349: Add API with array offset and length argument to FileUtils.writeByteArrayToFile. Thanks to scop.
o IO-348: Missing information in IllegalArgumentException thrown by org.apache.commons.io.FileUtils#validateListFilesParameters. Thanks to plcstpierre.
o IO-345: Supply a hook method allowing Tailer actively determining stop condition. Thanks to mkresse.
o IO-437: Make IOUtils.EOF public and reuse it in various classes.
Fixed Bugs:
o IO-446: adds an endOfFileReached method to the TailerListener Thanks to Jeffrey Barrus.
o IO-484: FilenameUtils should handle embedded null bytes Thanks to Philippe Arteau.
o IO-481: Changed/Corrected algorithm for waitFor
o IO-428: BOMInputStream.skip returns wrong count if stream contains no BOM Thanks to Stefan Gmeiner.
o IO-488: FileUtils.waitFor(...) swallows thread interrupted status Thanks to Bjrn Buchner.
o IO-452: Support for symlinks with missing target. Added support for JDK7 symlink features when present Thanks to David Standish.
o IO-453: Regression in FileUtils.readFileToString from 2.0.1 Thanks to Steven Christou.
o IO-451: ant test fails - resources missing from test classpath Thanks to David Standish.
o IO-435: Document that FileUtils.deleteDirectory, directoryContains and cleanDirectory
may throw an IllegalArgumentException in case the passed directory does not
exist or is not a directory. Thanks to Dominik Stadler.
o IO-424: Javadoc fixes, mostly to appease 1.8.0 Thanks to Ville Skytt.
o IO-389: FileUtils.sizeOfDirectory can throw IllegalArgumentException Thanks to Austin Doupnik.
o IO-390: FileUtils.sizeOfDirectoryAsBigInteger can overflow.
Ensure that recursive calls all use BigInteger
o IO-385: FileUtils.doCopyFile can potentially loop for ever
Exit loop if no data to copy
o IO-383: FileUtils.doCopyFile caches the file size; needs to be documented
Added Javadoc; show file lengths in exception message
o IO-380: FileUtils.copyInputStreamToFile should document it closes the input source Thanks to claudio_ch.
o IO-279: Tailer erroneously considers file as new.
Fix to use file.lastModified() rather than System.currentTimeMillis()
o IO-356: CharSequenceInputStream#reset() behaves incorrectly in case when buffer size is not dividable by data size.
Fix code so skip relates to the encoded bytes; reset now re-encodes the data up to the point of the mark
o IO-368: ClassLoaderObjectInputStream does not handle primitive typed members
o IO-314: Deprecate all methods that use the default encoding
o IO-338: When a file is rotated, finish reading previous file prior to starting new one
o IO-354: Commons IO Tailer does not respect UTF-8 Charset.
o IO-323: What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
Added Javadoc.
o IO-372: FileUtils.moveDirectory can produce misleading error message on failiure
o IO-362: IOUtils.contentEquals* methods returns false if input1 == input2, should return true. Thanks to mmadson, ggregory.
o IO-357: [Tailer] InterruptedException while the thread is sleeping is silently ignored Thanks to mortenh.
o IO-352: Spelling fixes. Thanks to scop.
o IO-436: Improper Javadoc comment for FilenameUtils.indexOfExtension. Thanks to christoph.schneegans.
Changes:
o IO-433: Converted all testcases to JUnit 4
o IO-466: Added testcase to show this was fixed with IO-423
o IO-479: Correct exception message in FileUtils.getFile(File, String...) Thanks to Zhouce Chen.
o IO-465: Update to JUnit 4.12 Thanks to based2.
o IO-462: IOExceptionWithCause no longer needed
o IO-422: Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
o IO-239: Convert IOCase to a Java 1.5+ Enumeration
[N.B. this is binary compatible]
o IO-328: getPrefixLength returns null if filename has leading slashes
Javadoc: add examples to show correct behavior; add unit tests
o IO-299: FileUtils.listFilesAndDirs includes original dir in results even when it doesn't match filter
Javadoc: clarify that original dir is included in the results
o IO-375: FilenameUtils.splitOnTokens(String text) check for '**' could be simplified
o IO-374: WildcardFileFilter ctors should not use null to mean IOCase.SENSITIVE when delegating to other ctors
Compatibility with 2.4:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.5 requires Java 6 or later.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.4
==============================================================================
Changes in this version include:
New features:
o IO-269: Tailer locks file from deletion/rename on Windows. Thanks to
sebb.
o IO-333: Export OSGi packages at version 1.x in addition to 2.x. Thanks
to fmeschbe.
o IO-320: Add XmlStreamReader support for UTF-32. Thanks to ggregory.
o IO-331: BOMInputStream wrongly detects UTF-32LE_BOM files as
UTF-16LE_BOM files in method getBOM(). Thanks to ggregory.
o IO-327: Add byteCountToDisplaySize(BigInteger). Thanks to ggregory.
o IO-326: Add new FileUtils.sizeOf[Directory] APIs to return BigInteger.
Thanks to ggregory.
o IO-325: Add IOUtils.toByteArray methods to work with URL and URI. Thanks
to raviprak.
o IO-324: Add missing Charset sister APIs to method that take a String
charset name. Thanks to raviprak.
Fixed Bugs:
o IO-336: Yottabyte (YB) incorrectly defined in FileUtils. Thanks to
rleavelle.
o IO-279: Tailer erroneously considers file as new. Thanks to Sergio
Bossa, Chris Baron.
o IO-335: Tailer#readLines - incorrect CR handling.
o IO-334: FileUtils.toURLs throws NPE for null parameter; document the
behavior.
o IO-332: Improve tailer's reading performance. Thanks to liangly.
o IO-279: Improve Tailer performance with buffered reads (see IO-332).
o IO-329: FileUtils.writeLines uses unbuffered IO. Thanks to tivv.
o IO-319: FileUtils.sizeOfDirectory follows symbolic links. Thanks to
raviprak.
Compatibility with 2.3:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.3
==============================================================================
Changes in this version include:
New features:
o IO-322: Add and use class Charsets. Thanks to ggregory.
o IO-321: ByteOrderMark UTF_32LE is incorrect. Thanks to ggregory.
o IO-318: Add Charset sister APIs to method that take a String charset name. Thanks to ggregory.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.2
==============================================================================
Changes in this version include:
New features:
o Add IOUTils.toBufferedReader(Reader) Issue: IO-313. Thanks to ggregory.
o Allow applications to provide buffer (or size) for copyLarge methods. Issue: IO-308. Thanks to Manoj Mokashi.
o New copyLarge() method in IOUtils that takes additional offset, length arguments Issue: IO-305. Thanks to Manoj Mokashi.
o Use terabyte (TB), petabyte (PB) and exabyte (EB) in FileUtils.byteCountToDisplaySize(long size) Issue: IO-287. Thanks to Ron Kuris, Gary Gregory.
o FileUtils.listFiles() doesn't return directories Issue: IO-173. Thanks to Marcos Vincius da Silva.
o CharSequenceInputStream to efficiently stream content of a CharSequence Issue: IO-297. Thanks to Oleg Kalnichevski.
o The second constructor of Tailer class does not pass 'delay' to the third one Issue: IO-304. Thanks to liangly.
o TeeOutputStream does not call branch.close() when main.close() throws an exception Issue: IO-303. Thanks to fabian.barney.
o ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times Issue: IO-302. Thanks to jsteuerwald, detinho.
o Add IOUtils.closeQuietly(Selector) necessary Issue: IO-301. Thanks to kaykay.unique.
o IOUtils.closeQuietly() should take a ServerSocket as a parameter Issue: IO-292. Thanks to sebb.
o Add read/readFully methods to IOUtils Issue: IO-290. Thanks to sebb.
o Supply a ReversedLinesFileReader Issue: IO-288. Thanks to Georg Henzler.
o Add new function FileUtils.directoryContains. Issue: IO-291. Thanks to ggregory.
o FileUtils.contentEquals and IOUtils.contentEquals - Add option to ignore "line endings"
Added contentEqualsIgnoreEOL methods to both classes Issue: IO-275. Thanks to CJ Aspromgos.
Fixed Bugs:
o IOUtils.read(InputStream/Reader) ignores the offset parameter Issue: IO-311. Thanks to Robert Muir.
o CharSequenceInputStream(CharSequence s, Charset charset, int bufferSize) ignores bufferSize Issue: IO-312.
o FileUtils.moveDirectoryToDirectory removes source directory if destination is a subdirectory Issue: IO-300.
o ReaderInputStream#read(byte[] b, int off, int len) should check for valid parameters Issue: IO-307.
o ReaderInputStream#read(byte[] b, int off, int len) should always return 0 for length == 0 Issue: IO-306.
o "FileUtils#deleteDirectoryOnExit(File)" does not work Issue: IO-276. Thanks to nkami.
o BoundedInputStream.read() treats max differently from BoundedInputStream.read(byte[]...) Issue: IO-273. Thanks to sebb.
o Various methods of class 'org.apache.commons.io.FileUtils' incorrectly suppress 'java.io.IOException' Issue: IO-298. Thanks to Christian Schulte.
Changes:
o ReaderInputStream optimization: more efficient reading of small chunks of data Issue: IO-296. Thanks to Oleg Kalnichevski.
Compatibility with 2.1 and 1.4:
Binary compatible: Yes
Source compatible: Yes
Semantic compatible: Yes. Check the bug fixes section for semantic bug fixes
Commons IO 2.2 requires a minimum of Java 5.
Commons IO 1.4 requires a minimum of Java 1.3.
==============================================================================
Apache Commons IO Version 2.1
==============================================================================
New features:
o Use standard Maven directory layout Issue: IO-285. Thanks to ggregory.
o Add IOUtils API toString for URL and URI to get contents Issue: IO-284. Thanks to ggregory.
o Add API FileUtils.copyFile(File input, OutputStream output) Issue: IO-282. Thanks to ggregory.
o FileAlterationObserver has no getter for FileFilter Issue: IO-262.
o Add FileUtils.getFile API with varargs parameter Issue: IO-261.
o Add new APPEND parameter for writing string into files Issue: IO-182.
o Add new read method "toByteArray" to handle InputStream with known size. Issue: IO-251. Thanks to Marco Albini.
Fixed Bugs:
o Dubious use of mkdirs() return code Issue: IO-280. Thanks to sebb.
o ReaderInputStream enters infinite loop when it encounters an unmappable character Issue: IO-277.
o FileUtils.moveFile() Javadoc should specify FileExistsException thrown Issue: IO-264.
o ClassLoaderObjectInputStream does not handle Proxy classes Issue: IO-260.
o Tailer returning partial lines when reaching EOF before EOL Issue: IO-274. Thanks to Frank Grimes.
o FileUtils.copyFile() throws IOException when copying large files to a shared directory (on Windows) Issue: IO-266. Thanks to Igor Smereka.
o FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.
Improve coverage by also looking for hidden files. Issue: IO-263. Thanks to Gil Adam.
Changes:
o FileAlterationMonitor.stop(boolean allowIntervalToFinish) Issue: IO-259.
==============================================================================
Apache Commons IO Package 2.0.1
==============================================================================
Compatibility with 2.0 and 1.4
------------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 2.0.1 requires a minimum of Java 5
(Commons IO 1.4 had a minimum of Java 1.3)
Enhancements from 2.0
---------------------
* [IO-256] - Provide thread factory for FileAlternationMonitor
Bug fixes from 2.0
------------------
* [IO-257] - BOMInputStream.read(byte[]) can return 0 which it should not
* [IO-258] - XmlStreamReader consumes the stream during encoding detection
==============================================================================
Apache Commons IO Package 2.0
==============================================================================
Compatibility with 1.4
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 2.0 requires a minimum of Java 5
(Commons IO 1.4 had a minimum of Java 1.3)
Deprecations from 1.4
---------------------
- IOUtils
- write(StringBuffer, Writer) in favour of write(CharSequence, Writer)
- write(StringBuffer, OutputStream) in favour of write(CharSequence, OutputStream)
- write(StringBuffer, OutputStream, String) in favour of write(CharSequence, OutputStream, String)
- FileFilterUtils
- andFileFilter(IOFileFilter, IOFileFilter) in favour of and(IOFileFilter...)
- orFileFilter(IOFileFilter, IOFileFilter) in favour of or(IOFileFilter...)
Enhancements from 1.4
---------------------
* [IO-140] Move minimum Java requirement from Java 1.3 to Java 5
- use Generics
- add new CharSequence write() flavour methods to IOUtils and FileUtils
- replace StringBuffer with StringBuilder, where appropriate
- add new Reader/Writer methods to ProxyReader and ProxyWriter
- Annotate with @Override and @Deprecated
* [IO-178] New BOMInputStream and ByteOrderMark implementations - to detect and optionally exclude an initial Byte Order mark (BOM)
* [IO-197] New BoundedInputStream (copied from from Apache JackRabbit)
* [IO-193] New Broken Input and Output streams
* [IO-132] New File Listener/Monitor facility
* [IO-158] New ReaderInputStream and WriterOutputStream implementations
* [IO-139] New StringBuilder Writer implementation
* [IO-192] New Tagged Input and Output streams
* [IO-177] New Tailer class - simple implementation of the Unix "tail -f" functionality
* [IO-162] New XML Stream Reader/Writer implementations (from ROME via plexus-utils)
* [IO-142] Comparators - add facility to sort file lists/arrays
* [IO-186] Comparators - new Composite and Directory File Comparator implementations
* [IO-176] DirectoryWalker - add filterDirectoryContents() callback method for filtering directory contents
* [IO-210] FileFilter - new Magic Number FileFilter
* [IO-221] FileFilterUtils - add methods for suffix and prefix filters which take an IOCase object
* [IO-232] FileFilterUtils - add method for name filters which take an IOCase object
* [IO-229] FileFilterUtils - add varargs and() and or() methods
* [IO-198] FileFilterUtils - add ability to apply file filters to collections and arrays
* [IO-156] FilenameUtils - add normalize() and normalizeNoEndSeparator() methods which allow the separator character to be specified
* [IO-194] FileSystemUtils - add freeSpaceKb() method with no input arguments
* [IO-185] FileSystemUtils - add freeSpaceKb() methods that take a timeout parameter - fixes freeSpaceWindows() blocks
* [IO-155] FileUtils - use NIO to copy files
* [IO-168] FileUtils - add new isSymlink() method
* [IO-219] FileUtils - throw FileExistsException when moving a file or directory if the destination already exists
* [IO-234] FileUtils - add Methods for retrieving System User/Temp directories/paths
* [IO-208] FileUtils - add timeout (connection and read) support for copyURLToFile() method
* [IO-238] FileUtils - add sizeOf(File) method
* [IO-181] LineIterator now implements Iterable
* [IO-224] IOUtils - add closeQuietly(Closeable) and closeQuietly(Socket) methods
* [IO-203] IOUtils - add skipFully() method for InputStreams
* [IO-137] IOUtils and ByteArrayOutputStream - add toBufferedInputStream() method to avoid unnecessary array allocation/copy
* [IO-195] Proxy streams/Reader/Writer - provide exception handling methods
* [IO-211] Proxy Input/Output streams - add pre/post processing support
* [IO-242] Proxy Reader/Writer - add pre/post processing support
Bug fixes from 1.4
------------------
* [IO-214] ByteArrayOutputStream - fix inconsistent synchronization of fields
* [IO-201] Counting Input/Output streams - fix inconsistent synchronization
* [IO-159] FileCleaningTracker - fix remove() never returns null
* [IO-220] FileCleaningTracker - fix Vector performs badly under load
* [IO-167] FilenameUtils - fix case-insensitive string handling in FilenameUtils and FilesystemUtils
* [IO-179] FilenameUtils - fix StringIndexOutOfBounds exception in getPathNoEndSeparator()
* [IO-248] FilenameUtils - fix getFullPathNoEndSeparator() returns empty while path is a one level directory
* [IO-246] FilenameUtils - fix wildcardMatch gives incorrect results
* [IO-187] FileSystemUtils - fix freeSpaceKb() doesn't work with relative paths on Linux
* [IO-160] FileSystemUtils - fix freeSpace() fails on solaris
* [IO-209] FileSystemUtils - fix freeSpaceKb() fails to return correct size for a windows mount point
* [IO-163] FileUtils - fix toURLs() using deprecated method of conversion to URL
* [IO-168] FileUtils - fix Symbolic links followed when deleting directory
* [IO-231] FileUtils - fix wrong exception message generated in isFileNewer() method
* [IO-207] FileUtils - fix race condition in forceMkdir() method
* [IO-217] FileUtils - fix copyDirectoryToDirectory() makes infinite loops
* [IO-166] FileUtils - fix URL decoding in toFile(URL)
* [IO-190] FileUtils - fix copyDirectory not preserving lastmodified date on sub-directories
* [IO-240] FileFilterUtils - ensure cvsFilter and svnFilter are only created once.
* [IO-175] IOUtils - fix copyFile() issues with very large files
* [IO-191] Improvements from static analysis
* [IO-216] LockableFileWriter - delete files quietly when an exception is thrown during initialization
* [IO-243] SwappedDataInputStream - fix readBoolean is inverted
* [IO-235] Tests - remove unused YellOnFlushAndCloseOutputStream from CopyUtilsTest
* [IO-161] Tests - fix FileCleaningTrackerTestCase hanging
Documentation changes from 1.4
------------------------------
* [IO-183 FilenameUtils.getExtension() method documentation improvements
* [IO-226 FileUtils.byteCountToDisplaySize() documentation corrections
* [IO-205 FileUtils.forceMkdir() documentation improvements
* [IO-215 FileUtils copy file/directory improve documentation regarding preserving the last modified date
* [IO-189 HexDump.dump() method documentation improvements
* [IO-171 IOCase document that it assumes there are only two OSes: Windows and Unix
* [IO-223 IOUtils.copy() documentation corrections
* [IO-247 IOUtils.closeQuietly() improve documentation with examples
* [IO-202 NotFileFilter documentation corrections
* [IO-206 ProxyInputStream - fix misleading parameter names
* [IO-212 ProxyInputStream.skip() documentation corrections
==============================================================================
Apache Commons IO Version 1.4
==============================================================================
Compatibility with 1.3.2
------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 1.4 introduces four new implementations which depend on Java 4 features
(CharSequenceReader, FileWriterWithEncoding, IOExceptionWithCause and RegexFileFilter).
It has been built with the JDK source and target options set to Java 1.3 and, except for
those implementations, can be used with Java 1.3 (see IO IO-127).
Deprecations from 1.3.2
-----------------------
- FileCleaner deprecated in favour of FileCleaningTracker [see IO-116]
Bug fixes from 1.3.2
--------------------
- FileUtils
- forceDelete of orphaned Softlinks does not work [IO-147]
- Infinite loop on FileUtils.copyDirectory when the destination directory is within
the source directory [IO-141]
- Add a copyDirectory() method that makes use of FileFilter [IO-105]
- Add moveDirectory() and moveFile() methods [IO-77]
- HexDump
- HexDump's use of static StringBuffers isn't thread-safe [IO-136]
Enhancements from 1.3.2
-----------------------
- FileUtils
- Add a deleteQuietly method [IO-135]
- FilenameUtils
- Add file name extension separator constants[IO-149]
- IOExceptionWithCause [IO-148]
- Add a new IOException implementation with constructors which take a cause
- TeeInputStream [IO-129]
- Add new Tee input stream implementation
- FileWriterWithEncoding [IO-153]
- Add new File Writer implementation that accepts an encoding
- CharSequenceReader [IO-138]
- Add new Reader implementation that handles any CharSequence (String,
StringBuffer, StringBuilder or CharBuffer)
- ThesholdingOuputStream [IO-121]
- Add a reset() method which sets the count of the bytes written back to zero.
- DeferredFileOutputStream [IO-130]
- Add support for temporary files
- ByteArrayOutputStream
- Add a new write(InputStream) method [IO-152]
- New Closed Input/Output stream implementations [IO-122]
- AutoCloseInputStream - automatically closes and discards the underlying input stream
- ClosedInputStream - returns -1 for any read attempts
- ClosedOutputStream - throws an IOException for any write attempts
- CloseShieldInputStream - prevents the underlying input stream from being closed.
- CloseShieldOutputStream - prevents the underlying output stream from being closed.
- Add Singleton Constants to several stream classes [IO-143]
- PrefixFileFilter [IO-126]
- Add faciltiy to specify case sensitivity on prefix matching
- SuffixFileFilter [IO-126]
- Add faciltiy to specify case sensitivity on suffix matching
- RegexFileFilter [IO-74]
- Add new regular expression file filter implementation
- Make IOFileFilter implementations Serializable [IO-131]
- Improve IOFileFilter toString() methods [IO-120]
- Make fields final so classes are immutable/threadsafe [IO-133]
- changes to Age, Delegate, Name, Not, Prefix, Regex, Size, Suffix and Wildcard IOFileFilter
implementations.
- IOCase
- Add a compare method to IOCase [IO-144]
- Add a package of java.util.Comparator implementations for files [IO-145]
- DefaultFileComparator - compare files using the default File.compareTo(File) method.
- ExtensionFileComparator - compares files using file name extensions.
- LastModifiedFileComparator - compares files using the last modified date/time.
- NameFileComparator - compares files using file names.
- PathFileComparator - compares files using file paths.
- SizeFileComparator - compares files using file sizes.
==============================================================================
Apache Commons IO Version 1.3.2
==============================================================================
Compatibility with 1.3.1
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Compatibility with 1.3
----------------------
Binary compatible - No
See [IO-113]
Source compatible - No
See [IO-113]
Semantic compatible - Yes
Enhancements since 1.3.1
------------------------
- Created the FileCleaningTracker, basically a non-static version of the
FileCleaner, which can be controlled by the user. [IO-116]
- The FileCleaner is deprecated.
Bug fixes from 1.3.1
--------------------
- Some tests, which are implicitly assuming a Unix-like file system, are
now skipped on Windows. [IO-115]
- EndianUtils
- Both readSwappedUnsignedInteger(...) methods could return negative
numbers due to int/long casting. [IO-117]
Bug fixes from 1.3
------------------
- FileUtils
- NPE in openOutputStream(File) when file has no parent in path [IO-112]
- readFileToString(File) is not static [IO-113]
==============================================================================
Apache Commons IO Version 1.3.1
==============================================================================
Compatibility with 1.3
----------------------
Binary compatible - No
See [IO-113]
Source compatible - No
See [IO-113]
Semantic compatible - Yes
Bug fixes from 1.3
------------------
- FileUtils
- NPE in openOutputStream(File) when file has no parent in path [IO-112]
- readFileToString(File) is not static [IO-113]
==============================================================================
Apache Commons IO Version 1.3
==============================================================================
Compatibility with 1.2
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Deprecations from 1.2
---------------------
- WildcardFilter deprecated, replaced by WildcardFileFilter
- old class only accepted files, thus had a confusing dual purpose
- FileSystemUtils.freeSpace deprecated, replaced by freeSpaceKb
- freeSpace returns a result that varies by operating system and
thus isn't that useful
- freeSpaceKb returns much better and more consistent results
- freeSpaceKb existed in v1.2, so this is a gentle cutover
Bug fixes from 1.2
------------------
- LineIterator now implements Iterator
- It was always supposed to...
- FileSystemUtils.freeSpace/freeSpaceKb [IO-83]
- These should now work on AIX and HP-UX
- FileSystemUtils.freeSpace/freeSpaceKb [IO-90]
- Avoid infinite looping in Windows
- Catch more errors with nice messages
- FileSystemUtils.freeSpace [IO-91]
- This is now documented not to work on SunOS 5
- FileSystemUtils [IO-93]
- Fixed resource leak leading to 'Too many open files' error
- Previously did not destroy Process instances (as JDK Javadoc is so poor)
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027
- FileUtils.touch [IO-100]
- The touch method previously gave no indication when the file could not
be touched successfully (such as due to access restrictions) - it now
throws an IOException if the last modified date cannot be changed
- FileCleaner
- This now handles the situation where an error occurs when deleting the file
- IOUtils.copy [IO-84]
- Copy methods could return inaccurate byte/char count for large streams
- The copy(InputStream, OutputStream) method now returns -1 if the count is greater than an int
- The copy(Reader, Writer) method now throws now returns -1 if the count is greater than an int
- Added a new copyLarge(InputStream, OutputStream) method that returns a long
- Added a new copyLarge(Reader, Writer) method that returns a long
- CountingInputStream/CountingOutputStream [IO-84]
- Methods were declared as int thus the count was innacurate for large streams
- new long based methods getByteCount()/resetByteCount() added
- existing methods changed to throw an exception if the count is greater than an int
- FileBasedTestCase
- Fixed bug in compare content methods identified by GNU classpath
- EndianUtils.writeSwappedLong(byte[], int) [IO-101]
- An int overrun in the bit shifting when it should have been a long
- EndianUtils.writeSwappedLong(InputStream) [IO-102]
- The return of input.read(byte[]) was not being checked to ensure all 8 bytes were read
Enhancements from 1.2
---------------------
- DirectoryWalker [IO-86]
- New class designed for subclassing to walk through a set of files.
DirectoryWalker provides the walk of the directories, filtering of
directories and files, and cancellation support. The subclass must provide
the specific behavior, such as text searching or image processing.
- IOCase
- New class/enumeration for case-sensitivity control
- FilenameUtils
- New methods to handle case-sensitivity
- wildcardMatch - new method that has IOCase as a parameter
- equals - new method that has IOCase as a parameter
- FileUtils [IO-108] - new default encoding methods for:
- readFileToString(File)
- readLines(File)
- lineIterator(File)
- writeStringToFile(File, String)
- writeLines(File, Collection)
- writeLines(File, Collection, String)
- FileUtils.openOutputStream [IO-107]
- new method to open a FileOutputStream, creating parent directories if required
- FileUtils.touch
- FileUtils.copyURLToFile
- FileUtils.writeStringToFile
- FileUtils.writeByteArrayToFile
- FileUtils.writeLines
- enhanced to create parent directories if required
- FileUtils.openInputStream [IO-107]
- new method to open a FileInputStream, providing better error messages than the JDK
- FileUtils.isFileOlder
- new methods to check if a file is older (i.e. isFileOlder()) - counterparts
to the existing isFileNewer() methods.
- FileUtils.checksum, FileUtils.checksumCRC32
- new methods to create a checksum of a file
- FileUtils.copyFileToDirectory [IO-104]
- new variant that optionally retains the file date
- FileDeleteStrategy
- FileCleaner [IO-56,IO-70]
- FileDeleteStrategy is a strategy for handling file deletion
- This can be used as a calback in FileCleaner
- Together these allow FileCleaner to do a forceDelete to kill directories
- FileCleaner.exitWhenFinished [IO-99]
- A new method that allows the internal cleaner thread to be cleanly terminated
- WildcardFileFilter
- Replacement for WildcardFilter
- Accepts both files and directories
- Ability to control case-sensitivity
- NameFileFilter
- Ability to control case-sensitivity
- FileFileFilter
- New IOFileFilter implementation
- Accepts files where File.isFile() is true
- In other words it filters out directories
- Singleton instance provided (FILE)
- CanReadFileFilter
- New IOFileFilter implementation
- Accepts files where File.canRead() is true
- Singleton instances provided (CAN_READ/CANNOT_READ/READ_ONLY)
- CanWriteFileFilter
- New IOFileFilter implementation
- Accepts files where File.canWrite() is true
- Singleton instances provided (CAN_WRITE/CANNOT_WRITE)
- HiddenFileFilter
- New IOFileFilter implementation
- Accepts files where File.isHidden() is true
- Singleton instances provided (HIDDEN/VISIBLE)
- EmptyFileFilter
- New IOFileFilter implementation
- Accepts files or directories that are empty
- Singleton instances provided (EMPTY/NOT_EMPTY)
- TrueFileFilter/FalseFileFilter/DirectoryFileFilter
- New singleton instance constants (TRUE/FALSE/DIRECTORY)
- The new constants are more Java 5 friendly with regards to static imports
(whereas if everything uses INSTANCE, then they just clash)
- The old INSTANCE constants are still present and have not been deprecated
- FileFilterUtils.sizeRangeFileFilter
- new sizeRangeFileFilter(long minimumSize, long maximumSize) method which
creates a filter that accepts files within the specified size range.
- FileFilterUtils.makeDirectoryOnly/makeFileOnly
- two new methods that decorate a file filter to make it apply to
directories only or files only
- NullWriter
- New writer that acts as a sink for all data, as per /dev/null
- NullInputStream
- New input stream that emulates a stream of a specified size
- NullReader
- New reader that emulates a reader of a specified size
- ByteArrayOutputStream [IO-97]
- Performance enhancements
==============================================================================
Apache Commons IO Version 1.2
==============================================================================
Compatibility with 1.1
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Deprecations from 1.1
---------------------
Bug fixes from 1.1
------------------
- FileSystemUtils.freeSpace(drive)
Fix to allow Windows based command to function in French locale
- FileUtils.read*
Increase certainty that files are closed in case of error
- LockableFileWriter
Locking mechanism was broken and only provided limited protection [38942]
File deletion and locking in case of constructor error was broken
Enhancements from 1.1
---------------------
- AgeFileFilter/SizeFileFilter
New file filters that compares against the age and size of the file
- FileSystemUtils.freeSpaceKb(drive)
New method that unifies result to be in kilobytes [38574]
- FileUtils.contentEquals(File,File)
Performance improved by adding length and file location checking
- FileUtils.iterateFiles
Two new method to provide direct access to iterators over files
- FileUtils.lineIterator
IOUtils.lineIterator
New methods to provide an iterator over the lines in a file [38083]
- FileUtils.copyDirectoryToDirectory
New method to copy a directory to within another directory [36315]
==============================================================================
Apache Commons IO Version 1.1
==============================================================================
Incompatible changes from 1.0
-----------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes, except:
- FileUtils.writeStringToFile()
A null encoding previously used 'ISO-8859-1', now it uses the platform default
Generally this will make no difference
- LockableFileWriter
Improved validation and now create directories if necesssary
plus these bug fixes may affect you semantically:
- FileUtils.touch() (Bug fix 29821)
Now creates the file if it did not previously exist
- FileUtils.toFile(URL) (Bug fix 32575)
Now handles escape syntax such as %20
- FileUtils.sizeOfDirectory() (Bug fix 36801)
May now return a size of 0 if the directory is security restricted
Deprecations from 1.0
---------------------
- CopyUtils has been deprecated.
Its methods have been moved to IOUtils.
The new IOUtils methods handle nulls better, and have clearer names.
- IOUtils.toByteArray(String) - Use {@link String#getBytes()}
- IOUtils.toString(byte[]) - Use {@link String#String(byte[])}
- IOUtils.toString(byte[],String) - Use {@link String#String(byte[],String)}
Bug fixes from 1.0
------------------
- FileUtils - touch() [29821]
Now creates the file if it did not previously exist
- FileUtils - toFile(URL) [32575]
Now handles escape syntax such as %20
- FileFilterUtils - makeCVSAware(IOFileFilter) [33023]
Fixed bug that caused method to be completely broken
- CountingInputStream [33336]
Fixed bug that caused the count to reduce by one at the end of the stream
- CountingInputStream - skip(long) [34311]
Bytes from calls to this method were not previously counted
- NullOutputStream [33481]
Remove unnecessary synchronization
- AbstractFileFilter - accept(File, String) [30992]
Fixed broken implementation
- FileUtils [36801]
Previously threw NPE when listing files in a security restricted directory
Now throw IOException with a better message
- FileUtils - writeStringToFile()
Null encoding now correctly uses the platform default
Enhancements from 1.0
---------------------
- FilenameUtils - new class [33303,29351]
A static utility class for working with filenames
Seeks to ease the pain of developing on Windows and deploying on Unix
- FileSystemUtils - new class [32982,36325]
A static utility class for working with file systems
Provides one method at present, to get the free space on the filing system
- IOUtils - new public constants
Constants for directory and line separators on Windows and Unix
- IOUtils - toByteArray(Reader,encoding)
Handles encodings when reading to a byte array
- IOUtils - toCharArray(InputStream) [28979]
- toCharArray(InputStream,encoding)
- toCharArray(Reader)
Reads a stream/reader into a charatcter array
- IOUtils - readLines(InputStream) [36214]
- readLines(InputStream,encoding)
- readLines(Reader)
Reads a stream/reader line by line into a List of Strings
- IOUtils - toInputStream(String) [32958]
- toInputStream(String,encoding)
Creates an input stream that uses the string as a source of data
- IOUtils - writeLines(Collection,lineEnding,OutputStream) [36214]
- writeLines(Collection,lineEnding,OutputStream,encoding)
- writeLines(Collection,lineEnding,Writer)
Writes a collection to a stream/writer line by line
- IOUtils - write(...)
Write data to a stream/writer (moved from CopyUtils with better null handling)
- IOUtils - copy(...)
Copy data between streams (moved from CopyUtils with better null handling)
- IOUtils - contentEquals(Reader,Reader)
Method to compare the contents of two readers
- FileUtils - toFiles(URL[])
Converts an array of URLs to an array of Files
- FileUtils - copyDirectory() [32944]
New methods to copy a directory
- FileUtils - readFileToByteArray(File)
Reads an entire file into a byte array
- FileUtils - writeByteArrayToFile(File,byte[])
Writes a byte array to a file
- FileUtils - readLines(File,encoding) [36214]
Reads a file line by line into a List of Strings
- FileUtils - writeLines(File,encoding,List)
writeLines(File,encoding,List,lineEnding)
Writes a collection to a file line by line
- FileUtils - EMPTY_FILE_ARRAY
Constant for an empty array of File objects
- ConditionalFileFilter - new interface [30705]
Defines the behavior of list based filters
- AndFileFilter, OrFileFilter [30705]
Now support a list of filters to and/or
- WildcardFilter [31115]
New filter that can match using wildcard file names
- FileFilterUtils - makeSVNAware(IOFileFilter)
New method, like makeCVSAware, that ignores Subversion source control directories
- ClassLoaderObjectInputStream
An ObjectInputStream that supports a ClassLoader
- CountingInputStream,CountingOutputStream - resetCount() [28976]
Adds the ability to reset the count part way through reading/writing the stream
- DeferredFileOutputStream - writeTo(OutputStream) [34173]
New method to allow current contents to be written to a stream
- DeferredFileOutputStream [34142]
Performance optimizations avoiding double buffering
- LockableFileWriter - encoding support [36825]
Add support for character encodings to LockableFileWriter
Improve the validation
Create directories if necesssary
- IOUtils and EndianUtils are no longer final [28978]
Allows developers to have subclasses if desired
==============================================================================
Feedback
==============================================================================
Open source works best when you give feedback:
https://commons.apache.org/io/
Please direct all bug reports to JIRA
https://issues.apache.org/jira/browse/IO
Or subscribe to the commons-user mailing list (prefix emails by [io])
https://commons.apache.org/mail-lists.html
The Commons-IO Team
commons-io-2.11.0-src/SECURITY.md 0100644 0000000 0000000 00000001604 13612062727 016577 0 ustar 00root root 0000000 0000000
The Apache Commons security page is [https://commons.apache.org/security.html](https://commons.apache.org/security.html).
commons-io-2.11.0-src/checkstyle.xml 0100644 0000000 0000000 00000003263 13612062727 017671 0 ustar 00root root 0000000 0000000
commons-io-2.11.0-src/pom.xml 0100644 0000000 0000000 00000046421 13612062727 016331 0 ustar 00root root 0000000 0000000
org.apache.commonscommons-parent524.0.0commons-iocommons-io2.11.0Apache Commons IO2002
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
https://commons.apache.org/proper/commons-io/jirahttps://issues.apache.org/jira/browse/IOapache.websiteApache Commons Sitescm:svn:https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-io/scm:git:https://gitbox.apache.org/repos/asf/commons-io.gitscm:git:https://gitbox.apache.org/repos/asf/commons-io.githttps://gitbox.apache.org/repos/asf?p=commons-io.gitrel/commons-io-2.11.0Scott Sanderssanderssanders@apache.orgJava DeveloperdIon Gillarddiondion@apache.orgJava DeveloperNicola Ken Barozzinicolakennicolaken@apache.orgJava DeveloperHenri Yandellbayardbayard@apache.orgJava DeveloperStephen ColebournescolebourneJava Developer0Jeremias Maerkijeremiasjeremias@apache.orgJava Developer+1Matthew Hawthornematthmatth@apache.orgJava DeveloperMartin Coopermartincmartinc@apache.orgJava DeveloperRob Oxspringroxspringroxspring@apache.orgJava DeveloperJochen Wiedmannjochenjochen.wiedmann@gmail.comNiall PembertonniallpJava DeveloperJukka ZittingjukkaJava DeveloperggregoryGary Gregoryggregory at apache.orghttps://www.garygregory.comThe Apache Software Foundationhttps://www.apache.org/PMC MemberAmerica/New_Yorkhttps://people.apache.org/~ggregory/img/garydgregory80.pngKristian Rosenvoldkrosenvoldkrosenvold@apache.org+1Rahul AkolkarJason AndersonNathan BeyerEmmanuel BourgChris EldredgeMagnus GrimsellJim HarringtonThomas LedouxAndy LehaneMarcelo LiberatoAlban Peignieralban.peignier at free.frAdam RetterEvolved BinaryIan SpringerDominik StadlerMasato TezukaJames UrieFrank W. Zammettiorg.junitjunit-bom5.7.2pomimportorg.junit.jupiterjunit-jupitertestorg.junit-pioneerjunit-pioneer1.4.2testorg.mockitomockito-inline3.11.2testcom.google.jimfsjimfs1.2testorg.apache.commonscommons-lang33.12.0testorg.openjdk.jmhjmh-core${jmh.version}testorg.openjdk.jmhjmh-generator-annprocess${jmh.version}test1.81.8ioorg.apache.commons.ioRC12.10.02.11.0(requires Java 8)IO12310477
org.apache.commons.io;
org.apache.commons.io.comparator;
org.apache.commons.io.filefilter;
org.apache.commons.io.input;
org.apache.commons.io.output;version=1.4.9999;-noimport:=true,
org.apache.commons.io;
org.apache.commons.io.comparator;
org.apache.commons.io.filefilter;
org.apache.commons.io.input;
org.apache.commons.io.output;
org.apache.commons.io.*;version=${project.version};-noimport:=true
sun.nio.ch;resolution:=optional,
sun.misc;resolution:=optional,
*
https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-io/site-content3.1.20.8.73.0.0-M50.15.34.2.34.3.01.32false${env.JACOCO_SKIP}trueGary Gregory86fdc7e2a11262cbclean package apache-rat:check japicmp:cmp checkstyle:check javadoc:javadocorg.apache.ratapache-rat-plugin0.13src/test/resources/**/*.binsrc/test/resources/dir-equals-tests/**test/**org.apache.maven.pluginsmaven-checkstyle-plugin${checkstyle.plugin.version}${basedir}/checkstyle.xmlfalsecom.puppycrawl.toolscheckstyle8.44org.apache.maven.pluginsmaven-enforcer-plugin3.0.0-M3enforce-mavenenforce3.0.5org.apache.maven.pluginsmaven-jar-plugintest-jar${commons.module.name}org.apache.maven.pluginsmaven-surefire-pluginxerces:xercesImpl1false${argLine} -Xmx25M**/*Test*.class**/*AbstractTestCase***/testtools/****/*$*maven-assembly-pluginsrc/assembly/bin.xmlsrc/assembly/src.xmlgnuorg.apache.maven.pluginsmaven-checkstyle-pluginorg.apache.maven.pluginsmaven-scm-publish-pluginjavadocscom.github.spotbugsspotbugs-maven-plugin${spotbugs.plugin.version}com.github.spotbugsspotbugs${spotbugs.impl.version}${basedir}/spotbugs-exclude-filter.xmlcom.github.siom79.japicmpjapicmp-maven-pluginorg.apache.maven.pluginsmaven-checkstyle-plugincom.github.spotbugsspotbugs-maven-plugin${spotbugs.plugin.version}${basedir}/spotbugs-exclude-filter.xmlcom.github.siom79.japicmpjapicmp-maven-pluginsetup-checkoutsite-contentorg.apache.maven.pluginsmaven-antrun-plugin3.0.0prepare-checkoutpre-siterunjava9+[9,)truebenchmarktrueorg.apacheorg.codehaus.mojoexec-maven-plugin3.0.0benchmarktestexectestjava-classpathorg.openjdk.jmh.Main-rfjson-rfftarget/jmh-result.${benchmark}.json${benchmark}
commons-io-2.11.0-src/spotbugs-exclude-filter.xml 0100644 0000000 0000000 00000003072 13612062727 022311 0 ustar 00root root 0000000 0000000
commons-io-2.11.0-src/src/ 0040755 0000000 0000000 00000000000 13612062727 015577 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/assembly/ 0040755 0000000 0000000 00000000000 13612062727 017416 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/changes/ 0040755 0000000 0000000 00000000000 13612062727 017207 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/ 0040755 0000000 0000000 00000000000 13612062727 016523 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/ 0040755 0000000 0000000 00000000000 13612062727 017444 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/ 0040755 0000000 0000000 00000000000 13612062727 020233 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/ 0040755 0000000 0000000 00000000000 13612062727 021454 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/ 0040755 0000000 0000000 00000000000 13612062727 023127 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/ 0040755 0000000 0000000 00000000000 13612062727 023536 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/comparator/ 0040755 0000000 0000000 00000000000 13612062727 025705 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/file/ 0040755 0000000 0000000 00000000000 13612062727 024455 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/file/spi/ 0040755 0000000 0000000 00000000000 13612062727 025250 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/filefilter/ 0040755 0000000 0000000 00000000000 13612062727 025663 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/function/ 0040755 0000000 0000000 00000000000 13612062727 025363 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/input/ 0040755 0000000 0000000 00000000000 13612062727 024675 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/input/buffer/ 0040755 0000000 0000000 00000000000 13612062727 026146 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/monitor/ 0040755 0000000 0000000 00000000000 13612062727 025225 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/output/ 0040755 0000000 0000000 00000000000 13612062727 025076 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/main/java/org/apache/commons/io/serialization/ 0040755 0000000 0000000 00000000000 13612062727 026413 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/media/ 0040755 0000000 0000000 00000000000 13612062727 016656 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/site/ 0040755 0000000 0000000 00000000000 13612062727 016543 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/site/resources/ 0040755 0000000 0000000 00000000000 13612062727 020555 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/site/resources/images/ 0040755 0000000 0000000 00000000000 13612062727 022022 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/site/xdoc/ 0040755 0000000 0000000 00000000000 13612062727 017500 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/ 0040755 0000000 0000000 00000000000 13612062727 016556 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/ 0040755 0000000 0000000 00000000000 13612062727 017477 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/ 0040755 0000000 0000000 00000000000 13612062727 020266 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/ 0040755 0000000 0000000 00000000000 13612062727 021507 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/ 0040755 0000000 0000000 00000000000 13612062727 023162 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/ 0040755 0000000 0000000 00000000000 13612062727 023571 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/comparator/ 0040755 0000000 0000000 00000000000 13612062727 025740 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/file/ 0040755 0000000 0000000 00000000000 13612062727 024510 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/file/spi/ 0040755 0000000 0000000 00000000000 13612062727 025303 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/filefilter/ 0040755 0000000 0000000 00000000000 13612062727 025716 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/function/ 0040755 0000000 0000000 00000000000 13612062727 025416 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/input/ 0040755 0000000 0000000 00000000000 13612062727 024730 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/input/buffer/ 0040755 0000000 0000000 00000000000 13612062727 026201 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/input/compatibility/ 0040755 0000000 0000000 00000000000 13612062727 027601 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/jmh/ 0040755 0000000 0000000 00000000000 13612062727 024347 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/monitor/ 0040755 0000000 0000000 00000000000 13612062727 025260 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/output/ 0040755 0000000 0000000 00000000000 13612062727 025131 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/serialization/ 0040755 0000000 0000000 00000000000 13612062727 026446 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/java/org/apache/commons/io/test/ 0040755 0000000 0000000 00000000000 13612062727 024550 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/ 0040755 0000000 0000000 00000000000 13612062727 020570 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/ 0040755 0000000 0000000 00000000000 13612062727 023776 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/ 0040755 0000000 0000000 00000000000 13612062727 030643 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000145 13612062727 011641 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files1/0040755 0000000 0000000 00000000000 13612062727 033525 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000173 13612062727 011642 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files1/directory-files-only1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files1/0040755 0000000 0000000 00000000000 13612062727 033525 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000145 13612062727 011641 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files2/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files2/0040755 0000000 0000000 00000000000 13612062727 033526 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000173 13612062727 011642 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files2/directory-files-only2/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-and-files/dirs-and-files2/0040755 0000000 0000000 00000000000 13612062727 033526 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/ 0040755 0000000 0000000 00000000000 13612062727 031037 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir1/ 0040755 0000000 0000000 00000000000 13612062727 031676 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000161 13612062727 011637 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir1/directory-files-only1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir1/directory-0040755 0000000 0000000 00000000000 13612062727 033700 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir2/ 0040755 0000000 0000000 00000000000 13612062727 031677 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000161 13612062727 011637 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir2/directory-files-only1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/dir2/directory-0040755 0000000 0000000 00000000000 13612062727 033701 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000154 13612062727 011641 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/directory-files-only1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/directory-files0040755 0000000 0000000 00000000000 13612062727 034064 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000154 13612062727 011641 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/directory-files-only2/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-dirs-then-files/directory-files0040755 0000000 0000000 00000000000 13612062727 034064 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-files-only/ 0040755 0000000 0000000 00000000000 13612062727 030123 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000147 13612062727 011643 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-files-only/directory-files-only1/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-files-only/directory-files-only0040755 0000000 0000000 00000000000 13612062727 034127 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000147 13612062727 011643 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-files-only/directory-files-only2/ commons-io-2.11.0-src/src/test/resources/dir-equals-tests/dir-equals-files-only/directory-files-only0040755 0000000 0000000 00000000000 13612062727 034127 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/ 0040755 0000000 0000000 00000000000 13612062727 021357 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/ 0040755 0000000 0000000 00000000000 13612062727 022600 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/ 0040755 0000000 0000000 00000000000 13612062727 024253 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/ 0040755 0000000 0000000 00000000000 13612062727 024662 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-1-file-size-0/ 0040755 0000000 0000000 00000000000 13612062727 030003 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-1-file-size-1/ 0040755 0000000 0000000 00000000000 13612062727 030004 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-2-file-size-2/ 0040755 0000000 0000000 00000000000 13612062727 030006 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000146 13612062727 011642 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-2-file-size-2/dirs-a-file-size-1/ commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-2-file-size-2/dirs-a-file-size-10040755 0000000 0000000 00000000000 13612062727 033131 5 ustar 00root root 0000000 0000000 ././@LongLink 0100644 0000000 0000000 00000000146 13612062727 011642 L ustar 0000000 0000000 commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-2-file-size-2/dirs-b-file-size-1/ commons-io-2.11.0-src/src/test/resources/org/apache/commons/io/dirs-2-file-size-2/dirs-b-file-size-10040755 0000000 0000000 00000000000 13612062727 033132 5 ustar 00root root 0000000 0000000 commons-io-2.11.0-src/src/assembly/bin.xml 0100644 0000000 0000000 00000003404 13612062727 020706 0 ustar 00root root 0000000 0000000
bintar.gzzipfalseLICENSE.txtNOTICE.txtRELEASE-NOTES.txttarget*.jartarget/site/apidocsdocs**/customsorttypes.js**/sortabletable.js**/stringbuilder.js
commons-io-2.11.0-src/src/assembly/src.xml 0100644 0000000 0000000 00000003210 13612062727 020720 0 ustar 00root root 0000000 0000000
srctar.gzzip${artifactId}-${commons.release.version}-srccheckstyle.xmlCONTRIBUTING.mdLICENSE.txtNOTICE.txtpom.xmlPROPOSAL.htmlREADME.mdRELEASE-NOTES.txtSECURITY.mdspotbugs-exclude-filter.xmlsrc
commons-io-2.11.0-src/src/changes/changes.xml 0100644 0000000 0000000 00000172353 13612062727 021351 0 ustar 00root root 0000000 0000000
Apache Commons IO Release Notes
FileUtils.listFiles does not list matching files if File parameter is a symbolic link.
FileUtils#deleteDirectory(File) exception Javadoc inaccurate update #245.
Minor changes #243.
Replace construction of FileInputStream and FileOutputStream objects with Files NIO APIs. #221.
Fix IndexOutOfBoundsException in IOExceptionList constructors.
Remove IOException from the method signatures that no longer throw IOException.
This maintains binary compatibility but not source compatibility.
- FilenameUtils
directoryContains(String, String)
- BoundedReader
BoundedReader(java.io.Reader, int)
- IOUtils
lineIterator(java.io.InputStream, Charset)
lineIterator(java.io.InputStream, String)
toByteArray(String)
toInputStream(CharSequence, String)
toInputStream(String, String)
toString(byte[])
toString(byte[], String)
Add SymbolicLinkFileFilter.
Add test to make sure the setter of AndFileFilter works correctly #244.
Add XmlStreamReader(Path).
Bump mockito-inline from 3.11.0 to 3.11.2 #247.
Bump jmh.version from 1.27 to 1.32 #237.
Bump spotbugs from 4.2.3 to 4.3.0 #249.
RegexFileFilter uses the path and file name instead of just the file name.
The OSGi manifest now contains sun.* import packages #239.
Sanitize double slash after prefix #79.
Add and use RegexFileFilter.toString().
Add and use RegexFileFilter.RegexFileFilter(Pattern, Function<Path>, String>)
Add and use IOCase.isCaseSensitive(IOCase).
Bump actions/cache from 2.1.5 to 2.1.6 #238.
Bump junit-pioneer from 1.4.1 to 1.4.2 #240.
Bump checkstyle from 8.42 to 8.44 #241, #248.
Bump mockito-inline from 3.10.0 to 3.11.0 #242.
IOUtils.toByteArray(InputStream) Javadoc does not match code.
FileUtils: Remove Instant->ZonedDateTime->Instant round-trip.
Make FilenameUtils.equals() not throw an exception #154.
Un-deprecate IOUtils.closeQuietly() methods.
FileUtils#copyDirectory(File, File, FileFilter, preserveFileDate) clean up #163.
AccumulatorPathVisitor does not track directories properly.
FileUtils.iterateFiles runs out of memory when executed for a directory with large number of files.
Re-implement FileUtils' iterateFiles(), iterateFilesAndDirs(), listFiles(), listFilesAndDirs() to use NIO
file tree walking instead of IO file listings to avoid memory consumption issues on large file trees.
FileUtils.forceDelete(File) actually forces deletion of read-only files as it did in version 2.6.
PathUtils.deleteFile() no longer throws a NoSuchFileException when applied on a symbolic link pointing
to a file that doesn't exist.
Behavior change in FileUtils.copyDirectory() file last modified timestamp preservation. Match Javadoc to code.
Fix getPrefixLength method for Linux filename #179.
Wrong logging in FileUtils.setLastModified.
IOUtils.toByteArray(InputStream) Javadoc does not match code.
CopyUtils deprecation message gives wrong version.
Make PathUtils.setReadOnly deal with LinuxDosFileAttributeView #186.
FileUtils.forceDelete does not delete invalid links. #187.
IOUtils.toByteArray(null) no longer throws a NullPointerException.
MarkShieldInputStream#reset should throw UnsupportedOperationException.
LockableFileWriter.close() should fail when the lock file cannot be deleted.
Fix infinite loops in ObservableInputStream read(*) when an exception is caught but not re-thrown.
Fixed error of copying directories between different file systems #203.
Fix Typos in JavaDoc, Comments and Tests #201.
FileUtils.checksumCRC32 and FileUtils.checksum are not thread safe.
Fix error about usage of DirectBuffer in JRE 16/17 #205.
Prevent infinite loop with AbstractCharacterFilterReader if EOF is filtered out #226.
Check for long streams in IOUtils.toByteArray #175.
Add FileSystemProviders class.
Let org.apache.commons.io.filefilter classes work with java.nio.file.Files.walk* APIs.
Let org.apache.commons.io.filefilter classes work with java.nio.file.Files#newDirectoryStream(Path, DirectoryStream.Filter).
Add and adapt ReadAheadInputStream and BufferedFileChannelInputStream from Apache Spark.
Add PathUtils.createParentDirectories(Path, FileAttribute...).
Add factory methods to CloseShieldInputStream, CloseShieldReader, CloseShieldOutputStream, CloseShieldWriter, #173.
Add QueueInputStream and QueueOutputStream as simpler alternatives to PipedInputStream and PipedOutputStream #171.
Add StandardLineSeparator.
Replace magic numbers with constants with the new IOUtils.CR and LF.
Add FileSystem#supportsDriveLetter().
Add FileUtils.delete(File).
Add FileUtils.moveFile(File, File, CopyOption...) #185.
Add FileUtils.isEmptyDirectory(File).
Add FileUtils.lastModified[Unchecked](File) to workaround https://bugs.openjdk.java.net/browse/JDK-8177809.
Add null safe variants of isDirectory and isRegularFile.
Add and use IOExceptionList(String, List).
Add and use ObservableInputStream.ObservableInputStream(InputStream, Observer...).
Make ObservableInputStream.getObservers() public.
Add TimestampedObserver.
Add and use IOUtils.byteArray(*).
Make public and reuse IOUtils.EMPTY_BYTE_ARRAY.
Add IOUtils.copy(URL, File).
Add copy(URL, OutputStream).
Add DeferredFileOutputStream.toInputStream() #206.
Add CharacterSetFilterReader.CharacterSetFilterReader(Reader, Integer...).
Add AbstractCharacterFilterReader(Reader, IntPredicate), #227.
Add CharacterFilterReader(Reader, IntPredicate), #227.
Add CharacterFilterReaderIntPredicateTest, #227.
Add IOConsumer.noop().
Add constructor ThresholdingOutputStream(int, IOConsumer, IOFunction) and make the class concrete.
Add constructor accepting collection of file alteration observers #236.
Update junit-jupiter from 5.6.2 to 5.7.0 #153.
Update mockito-core from 3.5.9 to 3.10.0, #152, #155, #157, #166, #167, #169, #182.
Bump mockito-inline from 3.7.0 to 3.10.0 #188, #207, #230.
Update commons.jacoco.version 0.8.5 to 0.8.7, fixes Java 15 builds and up.
Update spotbugs from 4.1.2 to 4.2.2, 4.2.3, #158, #164, #165, #180, #199, #213, #224.
Bump spotbugs-maven-plugin from 4.0.4 to 4.2.3, #161, #172, #223.
Update org.junit-pioneer:junit-pioneer 0.9.0 -> 1.4,1, #159, #162, #170, #189, #191, #210, #229.
Update actions/checkout from v2.3.2 to v2.3.4, #156, #168.
Bump actions/setup-java from v1.4.2 to v2 #160.
Update maven-surefire-plugin from 2.22.2 to 3.0.0-M5.
Minor improvements, #176, 177, #190.
Update commons.japicmp.version 0.14.4 -> 0.15.3.
Tiny performance improvement in FileUtils#moveDirectoryToDirectory() #174.
Bump checkstyle from 8.38 to 8.42 #689, #209, #225.
Bump maven-checkstyle-plugin from 3.1.1 to 3.1.2 #198.
Bump jimfs from 1.1 to 1.2 #183.
Improve performance of IOUtils.contentEquals(InputStream, InputStream).
Improve performance of IOUtils.contentEquals(Reader, Reader).
Bump actions/cache from v2 to v2.1.5 #202, #228.
Bump junit-bom from 5.7.0 to 5.7.2 #200, #232.
Update from Apache Commons Lang 3.11 to 3.12.0.
Minor improvements #233.
Simplify Assertions in tests #234.
Add org.apache.commons.io.input.CircularInputStream.
Add org.apache.commons.io.file.PathUtils.cleanDirectory(Path, FileVisitOption...).
Add org.apache.commons.io.file.PathUtils.deleteDirectory(Path, FileVisitOption...).
Add NullAppendable.
CharSequenceReader.skip should return 0 instead of EOF on stream end #123.
Implement CharSequenceReader.ready() #122.
Fix code smells; fix typos #115.
Add caching for required charsets #120.
Make some simplifications #121.
InfiniteCircularInputStream is not infinite if its input buffer contains -1.
InfiniteCircularInputStream throws a divide-by-zero exception when reading if its input buffer is size 0.
FileSystem.getCurrent() does not return the correct enum.
input.AbstractCharacterFilterReader passes count of chars read #132.
Add PathUtils.getAclEntryList(Path).
Null-guard IOUtils.close(Closeable, IOConsumer).
Add ReversedLinesFileReader.readLines(int).
Add ReversedLinesFileReader.toString(int).
Add PathUtils.delete(Path, DeleteOption...).
Add PathUtils.deleteDirectory(Path, DeleteOption...).
Add PathUtils.deleteFile(Path, DeleteOption...).
Add PathUtils.setReadOnly(Path, boolean, LinkOption...).
Add CleaningPathVisitor.CleaningPathVisitor(PathCounters, DeleteOption[], String...).
Add DeletingPathVisitor.DeletingPathVisitor(PathCounters, DeleteOption[], String...).
CircularBufferInputStream.read() fails to convert byte to unsigned int
Fix SpotBugs issues in org.apache.commons.io.FileUtils.
Add RandomAccessFileInputStream.
IOUtils.close(Closeable) should allow a list of closeables.
Copying a File sets last modified date to 01 January 1970.
Add IOUtils.consume(InputStream).
Add isFileNewer() and isFileOlder() methods that support the Java 8 Date/Time API. #124.
Prevent NullPointerException in ReversedLinesFileReader constructors #117.
Add a MarkShieldInputStream #119.
Deprecate IOUtils.LINE_SEPARATOR in favor of Java 7's System.lineSeparator().
Replace FindBugs with SpotBugs.
maven-checkstyle-plugin 3.1.0 -> 3.1.1.
Update tests from org.apache.commons:commons-lang3 3.10 to 3.11.
Update commons-parent from 50 to 51 #129.
Update actions/checkout from v1 to v2.3.1 #126.
Update junit-pioneer from 0.6.0 to 0.9.0, #127, #135, #138.
Update mockito-core from 3.3.3 to 3.5.9 #128, #133, #145, #149, #151.
Update spotbugs from 4.0.6 to 4.1.1 #134.
Update actions/checkout from v2.3.1 to v2.3.2 #140.
Update actions/setup-java from v1.4.0 to v1.4.2 #141, #148.
Update com.github.siom79.japicmp:japicmp-maven-plugin 0.14.3 -> 0.14.4.
Some tests fail if the base path contains a space.
Adding the CircularBufferInputStream, and the PeekableInputStream.
Make methods in ObservableInputStream.Obsever public.
Thread bug in FileAlterationMonitor#stop(int).
Add org.apache.commons.io.FilenameUtils.isIllegalWindowsFileName(char).
Perform locale independent upper case conversions.
Missing Javadoc in FilenameUtils causing Travis-CI build to fail.
Remove redundant isDirectory() check in org.apache.commons.io.FileUtils.listFilesAndDirs(File, IOFileFilter, IOFileFilter).
Refactor duplicate code in org.apache.commons.io.FileUtils.
Add readers to filter out given characters: CharacterSetFilterReader and CharacterFilterReader.
FilenameUtils.normalize now verifies hostname syntax in UNC path.
Update org.apache.commons.io.FilenameUtils.isExtension(String, String[]) to use var args.
FileUtils.copyToFile(InputStream source, File destination) should not close input stream.
Add IOUtils copy methods with java.lang.Appendable as the target.
FileUtils.doCopyFile(File, File, boolean) can throw ClosedByInterruptException.
Add class CanExecuteFileFilter.
Make array declaration in ThresholdingOutputStream consistent with other array declarations in the library #77.
Support java.nio.Path and non-default file systems for ReversedLinesFileReader (#62).
Add a convenience NullPrintStream.
Update from Java 7 to Java 8.
Remove throws IOException in method isSymlink() #80.
Add class TeeReader.
Add classes ClosedReader and CloseShieldReader. #84.
Add classes TaggedWriter, ClosedWriter and BrokenWriter. #86.
Add classes TeeWriter, FilterCollectionWriter, ProxyCollectionWriter, IOExceptionList, IOIndexedException.
Add class AppendableWriter. #87.
Add class CloseShieldWriter. #83.
Add classes Added TaggedReader, ClosedReader and BrokenReader. #85.
Support sub sequences in CharSequenceReader. #91.
Corrected misleading exception message for FileUtils.copyDirectoryToDirectory.
A mistake in the FilenameUtils.concat()'s Javadoc about an absolute path.
Migration to JUnit Jupiter #97.
Deprecate org.apache.commons.io.output.NullOutputStream.NullOutputStream() in favor of org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM.
Add a CountingFileVisitor (as the basis for a forthcoming DeletingFileVisitor).
Add PathUtils for operations on NIO Path.
Add DeletingFileVisitor.
FileUtils#forceDelete should use Files#delete rather than File#delete so exception messages includes reason for failure.
Make getCause synchronized and use a Deque instead of a Stack #64.
Add org.apache.commons.io.IOUtils.close(Closeable).
Add and reuse org.apache.commons.io.IOUtils.closeQuitely(Closeable, Consumer<IOException>).
Add and reuse org.apache.commons.io.IOUtils.close(Closeable, IOConsumer<IOException>).
NPE in org.apache.commons.io.IOUtils.contentEquals(InputStream, InputStream) when only one input is null.
NPE in org.apache.commons.io.IOUtils.contentEquals(Reader, Reader) when only one input is null.
NPE in org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader) when only one input is null.
NPE in org.apache.commons.io.FileUtils.contentEqualsIgnoreEOL(File, File) when only one input is null.
Add org.apache.commons.io.file.PathUtils.fileContentEquals(Path, Path, OpenOption...).
Add a SequenceReader similar to java.io.SequenceInputStream.
Implement directory content equality. 100#.
Update tests from Apache Commons Lang 3.9 to 3.10.
Update tests org.junit-pioneer:junit-pioneer 0.3.0 -> 0.6.0.
Update tests org.junit.jupiter:junit-jupiter 5.5.2 -> 5.6.2.
Update tests org.mockito:mockito-core 3.0.0 -> 3.3.3.
Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108.
Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108.
org.apache.commons.io.FileUtils.copyURLToFile(*) open but do not close streams.
Normalize internal buffers to 8192 bytes.
Ensure that passing a null InputStream results in NPE with tests #112.
commons.jacoco.version 0.8.4 -> 0.8.5.
com.github.siom79.japicmp:japicmp-maven-plugin 0.14.1 -> 0.14.3.
Add functional interfaces IOFunction and IOSupplier #110.
Support sub sequences in CharSequenceReader #91.
Remove deprecated sudo setting. #113.
Make code style of hasBOM() consistent with getBOMCharsetName()
ClosedOutputStream#flush should throw
Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility
Documentation issue, fix 404 Javadoc issues in the description page
FileUtils#readFileToByteArray: optimize reading of files with known size
Throw a IllegalArgumentException instead of NullPointerException in FileSystemUtils.freeSpaceWindows().
Add convenience methods for copyToDirectory
Javadoc contradictory for FileFilterUtils.ageFileFilter(cutoff) and the filter it constructs: AgeFileFilter(cutoff)
FileUtilTestCase.testForceDeleteDir() should not delete testDirectory parent
fix Tailer.run race condition runaway logging
getPrefixLength return -1 if unix file contains colon
FileUtilsTestCase#testContentEqualsIgnoreEOL fails on Windows
.gitattributes not correctly applied
Allow Specifying Initial Buffer Size of DeferredFileOutputStream.
ThresholdingOutputStream.thresholdReached() results in FileNotFoundException.
After a few unit tests, a few newly created directories not cleaned completely.
Exceptions are suppressed incorrectly when copying files.
Update platform requirement to Java 7.
BOMInputStream shouldn't sort array of BOMs in-place.
Deprecate methods FileSystemUtils.freeSpaceKb().
Make LineIterator implement Closeable to support try-with-resources statements.
Deprecated of all IOUtils.closeQuietly() methods and use try-with-resources internally.
Add infinite circular input stream
Add a ByteOrderParser class.
Add ObservableInputStream
Add MessageDigestCalculatingInputStream
Add convenience methods for reading class path resources.
Remove org.apache.commons.io.Java7Support
Implement special case handling for NTFS ADS names: FilenameUtils.getExtension(String),
and FilenameUtils.indexOfExtension(String) are now throwing an IllegalArgumentException,
if the file name in question appears to identify an alternate data stream (Windows only).
Typo: In an IOUtils.java comment it says "focussed" instead of "focused".
Converted all test cases to JUnit 4
Add ValidatingObjectInputStream for controlled deserialization
adds an endOfFileReached method to the TailerListener
FilenameUtils should handle embedded null bytes
Changed/Corrected algorithm for waitFor
Support for additional encodings in ReversedLinesFileReader
BOMInputStream.skip returns wrong count if stream contains no BOM
Setter method for threshold on ThresholdingOutputStream
FileUtils.waitFor(...) swallows thread interrupted status
Support for symlinks with missing target. Added support for JDK7 symlink features when present
Added testcase to show this was fixed with IO-423
Correct exception message in FileUtils.getFile(File, String...)
Introduce new class AppendableOutputStream
Update to JUnit 4.12
IOExceptionWithCause no longer needed
Add WindowsLineEndingInputStream and UnixLineEndingInputStream.
Add a BoundedReader, a wrapper that can be used to constrain access
to an underlying stream when used with mark/reset -
to avoid overflowing the mark limit of the underlying buffer.
Regression in FileUtils.readFileToString from 2.0.1
ant test fails - resources missing from test classpath
Document that FileUtils.deleteDirectory, directoryContains and cleanDirectory
may throw an IllegalArgumentException in case the passed directory does not
exist or is not a directory.
Add API IOUtils.closeQuietly(Closeable...)
Javadoc fixes, mostly to appease 1.8.0
Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
Readfully() That Returns A Byte Array
Overload IOUtils buffer methods to accept buffer size
FileUtils.sizeOfDirectory can throw IllegalArgumentException
FileUtils.sizeOfDirectoryAsBigInteger can overflow.
Ensure that recursive calls all use BigInteger
Chunked IO for large arrays.
Added writeChunked(byte[], OutputStream) and writeChunked(char[] Writer)
Added ChunkedOutputStream, ChunkedWriter
FileUtils.doCopyFile can potentially loop for ever
Exit loop if no data to copy
FileUtils.doCopyFile caches the file size; needs to be documented
Added Javadoc; show file lengths in exception message
Convert IOCase to a Java 1.5+ Enumeration
[N.B. this is binary compatible]
Add Methods for Buffering Streams/Writers To IOUtils
Added overloaded buffer() methods - see also IO-330
IOUtils#toBufferedOutputStream/toBufferedWriter to conditionally wrap the output
Added overloaded buffer() methods - see also IO-233
Add FileUtils.copyInputStreamToFile API with option to leave the source open.
See copyInputStreamToFile(final InputStream source, final File destination, boolean closeSource)
FileUtils.copyInputStreamToFile should document it closes the input source
Tailer erroneously considers file as new.
Fix to use file.lastModified() rather than System.currentTimeMillis()
CharSequenceInputStream#reset() behaves incorrectly in case when buffer size is not dividable by data size.
Fix code so skip relates to the encoded bytes; reset now re-encodes the data up to the point of the mark
CharSequenceInputStream - add tests for available()
Fix code so it really does reflect a minimum available.
getPrefixLength returns null if filename has leading slashes
Javadoc: add examples to show correct behavior; add unit tests
FileUtils.listFilesAndDirs includes original dir in results even when it doesn't match filter
Javadoc: clarify that original dir is included in the results
Add ByteArrayOutputStream.toInputStream()
ClassLoaderObjectInputStream does not handle primitive typed members
A constant for holding the BOM character (U+FEFF)
Deprecate all methods that use the default encoding
When a file is rotated, finish reading previous file prior to starting new one
Commons IO Tailer does not respect UTF-8 Charset.
What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
Added Javadoc.
FileUtils.moveDirectory can produce misleading error message on failiure
FilenameUtils.splitOnTokens(String text) check for '**' could be simplified
WildcardFileFilter ctors should not use null to mean IOCase.SENSITIVE when delegating to other ctors
IOUtils.contentEquals* methods returns false if input1 == input2, should return true.
Add API FileUtils.forceMkdirsParent().
Add API Charsets.requiredCharsets().
Add IOUtils.skip and skipFully(ReadableByteChannel, long).
Add IOUtils.read and readFully(ReadableByteChannel, ByteBuffer buffer).
[Tailer] InterruptedException while the thread is sleeping is silently ignored
Add API IOUtils.copy(InputStream, OutputStream, int)
Add API with array offset and length argument to FileUtils.writeByteArrayToFile.
Spelling fixes.
Missing information in IllegalArgumentException thrown by org.apache.commons.io.FileUtils#validateListFilesParameters.
Supply a hook method allowing Tailer actively determining stop condition.
Improper Javadoc comment for FilenameUtils.indexOfExtension.
Make IOUtils.EOF public and reuse it in various classes.
org.apache.commons.io.comparator Javadoc is inconsistent with real code.
Yottabyte (YB) incorrectly defined in FileUtils.
Tailer locks file from deletion/rename on Windows.
Tailer erroneously considers file as new.
Tailer#readLines - incorrect CR handling.
FileUtils.toURLs throws NPE for null parameter; document the behavior.
Export OSGi packages at version 1.x in addition to 2.x.
Add XmlStreamReader support for UTF-32.
BOMInputStream wrongly detects UTF-32LE_BOM files as UTF-16LE_BOM files in method getBOM().
Improve tailer's reading performance.
Improve Tailer performance with buffered reads (see IO-332).
FileUtils.writeLines uses unbuffered IO.
Add byteCountToDisplaySize(BigInteger).
Add new FileUtils.sizeOf[Directory] APIs to return BigInteger.
Add IOUtils.toByteArray methods to work with URL and URI.
Add missing Charset sister APIs to method that take a String charset name.
FileUtils.sizeOfDirectory follows symbolic links.
Add and use class Charsets.
ByteOrderMark UTF_32LE is incorrect.
Add Charset sister APIs to method that take a String charset name.
Add IOUTils.toBufferedReader(Reader)
Allow applications to provide buffer (or size) for copyLarge methods.
IOUtils.read(InputStream/Reader) ignores the offset parameter
CharSequenceInputStream(CharSequence s, Charset charset, int bufferSize) ignores bufferSize
New copyLarge() method in IOUtils that takes additional offset, length arguments
FileUtils.moveDirectoryToDirectory removes source directory if destination is a sub-directory
ReaderInputStream#read(byte[] b, int off, int len) should check for valid parameters
Use terabyte (TB), petabyte (PB) and exabyte (EB) in FileUtils.byteCountToDisplaySize(long size)
ReaderInputStream#read(byte[] b, int off, int len) should always return 0 for length == 0
FileUtils.listFiles() doesn't return directories
"FileUtils#deleteDirectoryOnExit(File)" does not work
BoundedInputStream.read() treats max differently from BoundedInputStream.read(byte[]...)
CharSequenceInputStream to efficiently stream content of a CharSequence
ReaderInputStream optimization: more efficient reading of small chunks of data
Various methods of class 'org.apache.commons.io.FileUtils' incorrectly suppress 'java.io.IOException'
The second constructor of Tailer class does not pass 'delay' to the third one
TeeOutputStream does not call branch.close() when main.close() throws an exception
ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times
Add IOUtils.closeQuietly(Selector) necessary
IOUtils.closeQuietly() should take a ServerSocket as a parameter
Add read/readFully methods to IOUtils
Supply a ReversedLinesFileReader
Add new function FileUtils.directoryContains.
FileUtils.contentEquals and IOUtils.contentEquals - Add option to ignore "line endings"
Added contentEqualsIgnoreEOL methods to both classes
Use standard Maven directory layout
Add IOUtils API toString for URL and URI to get contents
Add API FileUtils.copyFile(File input, OutputStream output)
Dubious use of mkdirs() return code
ReaderInputStream enters infinite loop when it encounters an unmappable character
FileUtils.moveFile() Javadoc should specify FileExistsException thrown
FileAlterationObserver has no getter for FileFilter
Add FileUtils.getFile API with varargs parameter
ClassLoaderObjectInputStream does not handle Proxy classes
FileAlterationMonitor.stop(boolean allowIntervalToFinish)
Add new APPEND parameter for writing string into files
Tailer returning partial lines when reaching EOF before EOL
FileUtils.copyFile() throws IOException when copying large files to a shared directory (on Windows)
FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.
Improve coverage by also looking for hidden files.
Add new read method "toByteArray" to handle InputStream with known size.
TODO: Convert RELEASE-NOTES.txt from 2.0.1?
TODO: Convert RELEASE-NOTES.txt from 2.0?
TODO: Convert RELEASE-NOTES.txt from 1.4?
Some tests, which are implicitly assuming a Unix-like file
system, are now skipped on Windows.
Created the FileCleaningTracker, basically a non-static
version of the FileCleaner, which can be controlled by
the user.
EndianUtils - both readSwappedUnsignedInteger(...) methods could
return negative numbers due to int/long casting.
commons-io-2.11.0-src/src/changes/release-notes.vm 0100644 0000000 0000000 00000200276 13612062727 022325 0 ustar 00root root 0000000 0000000 ## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
Apache Commons IO
Version ${version}
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
$introduction.replaceAll("(? 3.1.1. Thanks to Gary Gregory.
o Update tests from org.apache.commons:commons-lang3 3.10 to 3.11. Thanks to Gary Gregory.
o Update commons-parent from 50 to 51 #129. Thanks to Gary Gregory.
o Update actions/checkout from v1 to v2.3.1 #126. Thanks to Gary Gregory.
o Update junit-pioneer from 0.6.0 to 0.8.0, #127, #135. Thanks to Gary Gregory.
o Update mockito-core from 3.3.3 to 3.5.9 #128, #133, #145, #149, #151. Thanks to Gary Gregory.
o Update spotbugs from 4.0.6 to 4.1.1 #134. Thanks to Dependabot.
o Update junit-pioneer from 0.8.0 to 0.9.0 #138. Thanks to Dependabot.
o Update actions/checkout from v2.3.1 to v2.3.2 #140. Thanks to Dependabot.
o Update actions/setup-java from v1.4.0 to v1.4.2 #141, #148. Thanks to Dependabot.
Compatibility with 2.7:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
==============================================================================
Apache Commons IO
Version 2.7
Release Notes
INTRODUCTION:
Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations, file filters,
file comparators, endian transformation classes, and much more.
==============================================================================
Apache Commons IO Version 2.7
==============================================================================
Java 8 required.
Changes in this version include:
New features:
o Adding the CircularBufferInputStream, and the PeekableInputStream.
o IO-553: Add org.apache.commons.io.FilenameUtils.isIllegalWindowsFileName(char).
o IO-577: Add readers to filter out given characters: CharacterSetFilterReader and CharacterFilterReader. Thanks to Gary Gregory.
o IO-594: Add IOUtils copy methods with java.lang.Appendable as the target. Thanks to Gary Gregory.
o IO-605: Add class CanExecuteFileFilter. Thanks to Gary Gregory.
o IO-578: Support java.nio.Path and non-default file systems for ReversedLinesFileReader (#62). Thanks to Mark Chesney.
o IO-608: Add a convenience NullPrintStream. Thanks to Gary Gregory.
o IO-612: Add class TeeReader. Thanks to Rob Spoor, Gary Gregory.
o IO-613: Add classes ClosedReader and CloseShieldReader. #84. Thanks to Rob Spoor, Gary Gregory.
o IO-614: Add classes TaggedWriter, ClosedWriter and BrokenWriter. #86. Thanks to Rob Spoor.
o IO-615: Add classes TeeWriter, FilterCollectionWriter, ProxyCollectionWriter, IOExceptionList, IOIndexedException. Thanks to Gary Gregory, Rob Spoor.
o IO-616: Add class AppendableWriter. #87. Thanks to Rob Spoor.
o IO-617: Add class CloseShieldWriter. #83. Thanks to Rob Spoor, Gary Gregory.
o IO-618: Add classes Added TaggedReader, ClosedReader and BrokenReader. #85. Thanks to Rob Spoor.
o IO-619: Support sub sequences in CharSequenceReader. #91. Thanks to Rob Spoor.
o IO-631: Add a CountingFileVisitor (as the basis for a forthcoming DeletingFileVisitor). Thanks to Gary Gregory.
o IO-632: Add PathUtils for operations on NIO Path. Thanks to Gary Gregory.
o IO-633: Add DeletingFileVisitor. Thanks to Gary Gregory.
o IO-635: Add org.apache.commons.io.IOUtils.close(Closeable). Thanks to Gary Gregory.
o IO-636: Add and reuse org.apache.commons.io.IOUtils.closeQuitely(Closeable, Consumer).
Add and reuse org.apache.commons.io.IOUtils.close(Closeable, IOConsumer). Thanks to Gary Gregory.
o IO-645: Add org.apache.commons.io.file.PathUtils.fileContentEquals(Path, Path, OpenOption...). Thanks to Gary Gregory.
o IO-458: Add a SequenceReader similar to java.io.SequenceInputStream. Thanks to Gary Gregory, Joshua Gitlin.
o IO-648: Implement directory content equality. 100#. Thanks to Gary Gregory.
o IO-648: Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108. Thanks to Adam Retter, Alex Herbert, Gary Gregory.
o IO-662: Refactor ByteArrayOutputStream into synchronized and unsynchronized versions #108. Thanks to Adam Retter, Gary Gregory.
Fixed Bugs:
o IO-589: Some tests fail if the base path contains a space.
o IO-582: Make methods in ObservableInputStream.Obsever public. Thanks to Bruno Palos.
o IO-535: Thread bug in FileAlterationMonitor.stop(int). Thanks to Svetlin Zarev, Anthony Raymond.
o IO-557: Perform locale independent upper case conversions. Thanks to luccioman.
o IO-570: Missing Javadoc in FilenameUtils causing Travis-CI build to fail. Thanks to Pranet Verma.
o IO-571: Remove redundant isDirectory() check in org.apache.commons.io.FileUtils.listFilesAndDirs(File, IOFileFilter, IOFileFilter). Thanks to pranet.
o IO-559: FilenameUtils.normalize now verifies hostname syntax in UNC path.
o IO-554: FileUtils.copyToFile(InputStream source, File destination) should not close input stream. Thanks to Michele Mariotti.
o IO-604: FileUtils.doCopyFile(File, File, boolean) can throw ClosedByInterruptException. Thanks to Gary Gregory.
o IO-625: Corrected misleading exception message for FileUtils.copyDirectoryToDirectory. Thanks to Mikko Maunu.
o IO-626: A mistake in the FilenameUtils.concat()'s Javadoc about an absolute path. Thanks to Yuji Konishi.
o IO-640: NPE in org.apache.commons.io.IOUtils.contentEquals(InputStream, InputStream) when only one input is null. Thanks to Gary Gregory.
o IO-641: NPE in org.apache.commons.io.IOUtils.contentEquals(Reader, Reader) when only one input is null. Thanks to Gary Gregory.
o IO-643: NPE in org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader) when only one input is null. Thanks to Gary Gregory.
o IO-644: NPE in org.apache.commons.io.FileUtils.contentEqualsIgnoreEOL(File, File) when only one input is null. Thanks to Gary Gregory.
o IO-664: org.apache.commons.io.FileUtils.copyURLToFile(*) open but do not close streams. Thanks to Gary Gregory.
Changes:
o IO-572: Refactor duplicate code in org.apache.commons.io.FileUtils. Thanks to Pranet Verma.
o IO-580: Update org.apache.commons.io.FilenameUtils.isExtension(String, String[]) to use var args.
o IO-701: Make array declaration in ThresholdingOutputStream consistent with other array declarations in the library #77. Thanks to Raymond Tan.
o IO-607: Update from Java 7 to Java 8. Thanks to Gary Gregory.
o IO-610: Remove throws IOException in method isSymlink() #80. Thanks to Sebastian.
o IO-628: Migration to JUnit Jupiter #97. Thanks to Allon Mureinik.
o IO-630: Deprecate org.apache.commons.io.output.NullOutputStream.NullOutputStream() in favor of org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM. Thanks to Gary Gregory.
o IO-629: FileUtils#forceDelete should use Files#delete rather than File#delete so exception messages includes reason for failure. Thanks to Ian Springer, Ian Springer, Gary Gregory.
o IO-634: Make getCause synchronized and use a Deque instead of a Stack #64. Thanks to Vclav Haisman, Bruno P. Kinoshita, Gary Gregory.
o Update tests from Apache Commons Lang 3.9 to 3.10. Thanks to Gary Gregory.
o Update tests org.junit-pioneer:junit-pioneer 0.3.0 -> 0.6.0. Thanks to Gary Gregory.
o Update tests org.junit.jupiter:junit-jupiter 5.5.2 -> 5.6.2. Thanks to Gary Gregory.
o Update tests org.mockito:mockito-core 3.0.0 -> 3.3.3. Thanks to Gary Gregory.
o IO-666: Normalize internal buffers to 8192 bytes. Thanks to Gary Gregory.
o IO-665: Ensure that passing a null InputStream results in NPE with tests #112. Thanks to Otto Fowler, Gary Gregory.
o commons.jacoco.version 0.8.4 -> 0.8.5. Thanks to Gary Gregory.
o com.github.siom79.japicmp:japicmp-maven-plugin 0.14.1 -> 0.14.3. Thanks to Gary Gregory.
o IO-667: Add functional interfaces IOFunction and IOSupplier #110. Thanks to Adam Retter, Gary Gregory.
o Support sub sequences in CharSequenceReader #91. Thanks to Rob Spoor, Gary Gregory.
o Remove deprecated sudo setting. #113. Thanks to dengliming.
Compatibility with 2.6:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Commons IO 2.7 requires Java 8.
Commons IO 2.6 requires Java 7.
Commons IO 2.5 requires Java 6.
Commons IO 2.4 requires Java 6.
Commons IO 2.3 requires Java 6.
Commons IO 2.2 requires Java 5.
Commons IO 1.4 requires Java 1.3.
Historical list of changes: https://commons.apache.org/proper/commons-io/changes-report.html
For complete information on Apache Commons IO, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons IO website:
https://commons.apache.org/proper/commons-io/
Download page: https://commons.apache.org/proper/commons-io/download_io.cgi
Have fun!
-Apache Commons Team
==============================================================================
Apache Commons IO Version 2.6
==============================================================================
INTRODUCTION:
Apache Commons IO is a package of Java utility classes like java.io.
Classes in this package are considered to be so standard and of such high
reuse as to justify existence in java.io.
The Apache Commons IO library contains utility classes, stream implementations,
file filters, file comparators, endian transformation classes, and much more.
Apache Commons IO 2.6 requires at least Java 7 to build and run.
DEPRECATIONS
============
All closeQuietly overloads in org.apache.commons.io.IOUtils have been
deprecated. Use the try-with-resources statement or handle suppressed
exceptions manually.
The class org.apache.commons.io.FileSystemUtils has been deprecated.
Use equivalent methods in java.nio.file.FileStore instead, e.g.
Files.getFileStore(Paths.get("/home")).getUsableSpace() or iterate over
FileSystems.getDefault().getFileStores().
COMPATIBILITY WITH JAVA 9
==================
The MANIFEST.MF now contains an additional entry:
Automatic-Module-Name: org.apache.commons.io
This should make it possible to use Commons IO 2.6 as a module in the Java 9
module system. For more information see the corresponding issue:
https://issues.apache.org/jira/browse/IO-551
Building Commons IO 2.6 should work out of the box with the latest Java 9
release. Please report any Java 9 related issues at:
https://issues.apache.org/jira/browse/IO
NEW FEATURES
============
o IO-551: Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility.
o IO-367: Add convenience methods for copyToDirectory. Thanks to James Sawle.
o IO-493: Add infinite circular input stream. Thanks to Piotr Turski.
o IO-507: Add a ByteOrderUtils class.
o IO-518: Add ObservableInputStream.
o IO-519: Add MessageDigestCalculatingInputStream.
o IO-513: Add convenience methods for reading class path resources.
Thanks to Behrang Saeedzadeh.
FIXED BUGS
==========
o IO-546: ClosedOutputStream#flush should throw. Thanks to Tomas Celaya.
o IO-550: Documentation issue, fix 404 Javadoc issues in the description page.
Thanks to Jimi Adrian.
o IO-442: Javadoc contradictory for FileFilterUtils.ageFileFilter(cutoff) and
the filter it constructs: AgeFileFilter(cutoff).
Thanks to Simon Robinson.
o IO-534: FileUtilTestCase.testForceDeleteDir() should not delete testDirectory
parent.
o IO-528: Fix Tailer.run race condition runaway logging. Thanks to Dave Moten.
o IO-483: getPrefixLength return -1 if unix file contains colon.
Thanks to Marko Vasic.
o IO-520: FileUtilsTestCase#testContentEqualsIgnoreEOL fails on Windows.
o IO-516: .gitattributes not correctly applied. Thanks to Jason Pyeron.
o IO-515: Allow Specifying Initial Buffer Size of DeferredFileOutputStream.
Thanks to Brett Lounsbury, Gary Gregory.
o IO-512: ThresholdingOutputStream.thresholdReached() results in
FileNotFoundException. Thanks to Ralf Hauser.
o IO-511: After a few unit tests, a few newly created directories not cleaned
completely. Thanks to Ahmet Celik.
o IO-502: Exceptions are suppressed incorrectly when copying files.
Thanks to Christian Schulte.
o IO-503: Update platform requirement to Java 7.
o IO-537: BOMInputStream shouldn't sort array of BOMs in-place.
Thanks to Borys Zibrov.
CHANGES
=======
o IO-553: Make code style of hasBOM() consistent with getBOMCharsetName().
Thanks to Michael Ernst.
o IO-542: FileUtils#readFileToByteArray: optimize reading of files with known
size. Thanks to Ilmars Poikans.
o IO-547: Throw a IllegalArgumentException instead of NullPointerException in
FileSystemUtils.freeSpaceWindows(). Thanks to Nikhil Shinde,
Michael Ernst, Gary Greory.
o IO-506: Deprecate methods FileSystemUtils.freeSpaceKb().
Thanks to Christian Schulte.
o IO-505: Make LineIterator implement Closeable to support try-with-resources
statements. Thanks to Christian Schulte.
o IO-504: Deprecated of all IOUtils.closeQuietly() methods and use
try-with-resources internally. Thanks to Christian Schulte.
REMOVED
=======
o IO-514: Remove org.apache.commons.io.Java7Support.
COMPATIBILITY WITH OLDER VERSIONS
=================================
Compatibility with 2.5:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.6 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in
https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in
https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.6 requires Java 7 or later.
Commons IO 2.5 requires Java 6 or later.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.5
==============================================================================
New features and bug fixes.
Changes in this version include:
New features:
o IO-487: Add ValidatingObjectInputStream for controlled deserialization
o IO-471: Support for additional encodings in ReversedLinesFileReader Thanks to Leandro Reis.
o IO-425: Setter method for threshold on ThresholdingOutputStream Thanks to Craig Swank.
o IO-406: Introduce new class AppendableOutputStream Thanks to Niall Pemberton.
o IO-459: Add WindowsLineEndingInputStream and UnixLineEndingInputStream. Thanks to Kristian Rosenvold.
o IO-457: Add a BoundedReader, a wrapper that can be used to constrain access
to an underlying stream when used with mark/reset -
to avoid overflowing the mark limit of the underlying buffer. Thanks to Kristian Rosenvold.
o IO-426: Add API IOUtils.closeQuietly(Closeable...)
o IO-410: Readfully() That Returns A Byte Array Thanks to Beluga Behr.
o IO-395: Overload IOUtils buffer methods to accept buffer size Thanks to Beluga Behr.
o IO-382: Chunked IO for large arrays.
Added writeChunked(byte[], OutputStream) and writeChunked(char[] Writer)
Added ChunkedOutputStream, ChunkedWriter
o IO-233: Add Methods for Buffering Streams/Writers To IOUtils
Added overloaded buffer() methods - see also IO-330
o IO-330: IOUtils#toBufferedOutputStream/toBufferedWriter to conditionally wrap the output
Added overloaded buffer() methods - see also IO-233
o IO-381: Add FileUtils.copyInputStreamToFile API with option to leave the source open.
See copyInputStreamToFile(final InputStream source, final File destination, boolean closeSource)
o IO-379: CharSequenceInputStream - add tests for available()
Fix code so it really does reflect a minimum available.
o IO-346: Add ByteArrayOutputStream.toInputStream()
o IO-341: A constant for holding the BOM character (U+FEFF)
o IO-361: Add API FileUtils.forceMkdirsParent().
o IO-360: Add API Charsets.requiredCharsets().
o IO-359: Add IOUtils.skip and skipFully(ReadableByteChannel, long). Thanks to yukoba.
o IO-358: Add IOUtils.read and readFully(ReadableByteChannel, ByteBuffer buffer). Thanks to yukoba.
o IO-353: Add API IOUtils.copy(InputStream, OutputStream, int) Thanks to ggregory.
o IO-349: Add API with array offset and length argument to FileUtils.writeByteArrayToFile. Thanks to scop.
o IO-348: Missing information in IllegalArgumentException thrown by org.apache.commons.io.FileUtils#validateListFilesParameters. Thanks to plcstpierre.
o IO-345: Supply a hook method allowing Tailer actively determining stop condition. Thanks to mkresse.
o IO-437: Make IOUtils.EOF public and reuse it in various classes.
Fixed Bugs:
o IO-446: adds an endOfFileReached method to the TailerListener Thanks to Jeffrey Barrus.
o IO-484: FilenameUtils should handle embedded null bytes Thanks to Philippe Arteau.
o IO-481: Changed/Corrected algorithm for waitFor
o IO-428: BOMInputStream.skip returns wrong count if stream contains no BOM Thanks to Stefan Gmeiner.
o IO-488: FileUtils.waitFor(...) swallows thread interrupted status Thanks to Bjrn Buchner.
o IO-452: Support for symlinks with missing target. Added support for JDK7 symlink features when present Thanks to David Standish.
o IO-453: Regression in FileUtils.readFileToString from 2.0.1 Thanks to Steven Christou.
o IO-451: ant test fails - resources missing from test classpath Thanks to David Standish.
o IO-435: Document that FileUtils.deleteDirectory, directoryContains and cleanDirectory
may throw an IllegalArgumentException in case the passed directory does not
exist or is not a directory. Thanks to Dominik Stadler.
o IO-424: Javadoc fixes, mostly to appease 1.8.0 Thanks to Ville Skytt.
o IO-389: FileUtils.sizeOfDirectory can throw IllegalArgumentException Thanks to Austin Doupnik.
o IO-390: FileUtils.sizeOfDirectoryAsBigInteger can overflow.
Ensure that recursive calls all use BigInteger
o IO-385: FileUtils.doCopyFile can potentially loop for ever
Exit loop if no data to copy
o IO-383: FileUtils.doCopyFile caches the file size; needs to be documented
Added Javadoc; show file lengths in exception message
o IO-380: FileUtils.copyInputStreamToFile should document it closes the input source Thanks to claudio_ch.
o IO-279: Tailer erroneously considers file as new.
Fix to use file.lastModified() rather than System.currentTimeMillis()
o IO-356: CharSequenceInputStream#reset() behaves incorrectly in case when buffer size is not dividable by data size.
Fix code so skip relates to the encoded bytes; reset now re-encodes the data up to the point of the mark
o IO-368: ClassLoaderObjectInputStream does not handle primitive typed members
o IO-314: Deprecate all methods that use the default encoding
o IO-338: When a file is rotated, finish reading previous file prior to starting new one
o IO-354: Commons IO Tailer does not respect UTF-8 Charset.
o IO-323: What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
Added Javadoc.
o IO-372: FileUtils.moveDirectory can produce misleading error message on failiure
o IO-362: IOUtils.contentEquals* methods returns false if input1 == input2, should return true. Thanks to mmadson, ggregory.
o IO-357: [Tailer] InterruptedException while the thread is sleeping is silently ignored Thanks to mortenh.
o IO-352: Spelling fixes. Thanks to scop.
o IO-436: Improper Javadoc comment for FilenameUtils.indexOfExtension. Thanks to christoph.schneegans.
Changes:
o IO-433: Converted all testcases to JUnit 4
o IO-466: Added testcase to show this was fixed with IO-423
o IO-479: Correct exception message in FileUtils.getFile(File, String...) Thanks to Zhouce Chen.
o IO-465: Update to JUnit 4.12 Thanks to based2.
o IO-462: IOExceptionWithCause no longer needed
o IO-422: Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
o IO-239: Convert IOCase to a Java 1.5+ Enumeration
[N.B. this is binary compatible]
o IO-328: getPrefixLength returns null if filename has leading slashes
Javadoc: add examples to show correct behavior; add unit tests
o IO-299: FileUtils.listFilesAndDirs includes original dir in results even when it doesn't match filter
Javadoc: clarify that original dir is included in the results
o IO-375: FilenameUtils.splitOnTokens(String text) check for '**' could be simplified
o IO-374: WildcardFileFilter ctors should not use null to mean IOCase.SENSITIVE when delegating to other ctors
Compatibility with 2.4:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.5 requires Java 6 or later.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.4
==============================================================================
Changes in this version include:
New features:
o IO-269: Tailer locks file from deletion/rename on Windows. Thanks to
sebb.
o IO-333: Export OSGi packages at version 1.x in addition to 2.x. Thanks
to fmeschbe.
o IO-320: Add XmlStreamReader support for UTF-32. Thanks to ggregory.
o IO-331: BOMInputStream wrongly detects UTF-32LE_BOM files as
UTF-16LE_BOM files in method getBOM(). Thanks to ggregory.
o IO-327: Add byteCountToDisplaySize(BigInteger). Thanks to ggregory.
o IO-326: Add new FileUtils.sizeOf[Directory] APIs to return BigInteger.
Thanks to ggregory.
o IO-325: Add IOUtils.toByteArray methods to work with URL and URI. Thanks
to raviprak.
o IO-324: Add missing Charset sister APIs to method that take a String
charset name. Thanks to raviprak.
Fixed Bugs:
o IO-336: Yottabyte (YB) incorrectly defined in FileUtils. Thanks to
rleavelle.
o IO-279: Tailer erroneously considers file as new. Thanks to Sergio
Bossa, Chris Baron.
o IO-335: Tailer#readLines - incorrect CR handling.
o IO-334: FileUtils.toURLs throws NPE for null parameter; document the
behavior.
o IO-332: Improve tailer's reading performance. Thanks to liangly.
o IO-279: Improve Tailer performance with buffered reads (see IO-332).
o IO-329: FileUtils.writeLines uses unbuffered IO. Thanks to tivv.
o IO-319: FileUtils.sizeOfDirectory follows symbolic links. Thanks to
raviprak.
Compatibility with 2.3:
Binary compatible: Yes.
Source compatible: Yes.
Semantic compatible: Yes.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.4 requires Java 6 or later.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.3
==============================================================================
Changes in this version include:
New features:
o IO-322: Add and use class Charsets. Thanks to ggregory.
o IO-321: ByteOrderMark UTF_32LE is incorrect. Thanks to ggregory.
o IO-318: Add Charset sister APIs to method that take a String charset name. Thanks to ggregory.
Compatibility with 2.2 and 1.4:
Binary compatible: Yes.
Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
Commons IO 2.3 requires Java 6 or later.
Commons IO 2.2 requires Java 5 or later.
Commons IO 1.4 requires Java 1.3 or later.
==============================================================================
Apache Commons IO Version 2.2
==============================================================================
Changes in this version include:
New features:
o Add IOUTils.toBufferedReader(Reader) Issue: IO-313. Thanks to ggregory.
o Allow applications to provide buffer (or size) for copyLarge methods. Issue: IO-308. Thanks to Manoj Mokashi.
o New copyLarge() method in IOUtils that takes additional offset, length arguments Issue: IO-305. Thanks to Manoj Mokashi.
o Use terabyte (TB), petabyte (PB) and exabyte (EB) in FileUtils.byteCountToDisplaySize(long size) Issue: IO-287. Thanks to Ron Kuris, Gary Gregory.
o FileUtils.listFiles() doesn't return directories Issue: IO-173. Thanks to Marcos Vincius da Silva.
o CharSequenceInputStream to efficiently stream content of a CharSequence Issue: IO-297. Thanks to Oleg Kalnichevski.
o The second constructor of Tailer class does not pass 'delay' to the third one Issue: IO-304. Thanks to liangly.
o TeeOutputStream does not call branch.close() when main.close() throws an exception Issue: IO-303. Thanks to fabian.barney.
o ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times Issue: IO-302. Thanks to jsteuerwald, detinho.
o Add IOUtils.closeQuietly(Selector) necessary Issue: IO-301. Thanks to kaykay.unique.
o IOUtils.closeQuietly() should take a ServerSocket as a parameter Issue: IO-292. Thanks to sebb.
o Add read/readFully methods to IOUtils Issue: IO-290. Thanks to sebb.
o Supply a ReversedLinesFileReader Issue: IO-288. Thanks to Georg Henzler.
o Add new function FileUtils.directoryContains. Issue: IO-291. Thanks to ggregory.
o FileUtils.contentEquals and IOUtils.contentEquals - Add option to ignore "line endings"
Added contentEqualsIgnoreEOL methods to both classes Issue: IO-275. Thanks to CJ Aspromgos.
Fixed Bugs:
o IOUtils.read(InputStream/Reader) ignores the offset parameter Issue: IO-311. Thanks to Robert Muir.
o CharSequenceInputStream(CharSequence s, Charset charset, int bufferSize) ignores bufferSize Issue: IO-312.
o FileUtils.moveDirectoryToDirectory removes source directory if destination is a subdirectory Issue: IO-300.
o ReaderInputStream#read(byte[] b, int off, int len) should check for valid parameters Issue: IO-307.
o ReaderInputStream#read(byte[] b, int off, int len) should always return 0 for length == 0 Issue: IO-306.
o "FileUtils#deleteDirectoryOnExit(File)" does not work Issue: IO-276. Thanks to nkami.
o BoundedInputStream.read() treats max differently from BoundedInputStream.read(byte[]...) Issue: IO-273. Thanks to sebb.
o Various methods of class 'org.apache.commons.io.FileUtils' incorrectly suppress 'java.io.IOException' Issue: IO-298. Thanks to Christian Schulte.
Changes:
o ReaderInputStream optimization: more efficient reading of small chunks of data Issue: IO-296. Thanks to Oleg Kalnichevski.
Compatibility with 2.1 and 1.4:
Binary compatible: Yes
Source compatible: Yes
Semantic compatible: Yes. Check the bug fixes section for semantic bug fixes
Commons IO 2.2 requires a minimum of Java 5.
Commons IO 1.4 requires a minimum of Java 1.3.
==============================================================================
Apache Commons IO Version 2.1
==============================================================================
New features:
o Use standard Maven directory layout Issue: IO-285. Thanks to ggregory.
o Add IOUtils API toString for URL and URI to get contents Issue: IO-284. Thanks to ggregory.
o Add API FileUtils.copyFile(File input, OutputStream output) Issue: IO-282. Thanks to ggregory.
o FileAlterationObserver has no getter for FileFilter Issue: IO-262.
o Add FileUtils.getFile API with varargs parameter Issue: IO-261.
o Add new APPEND parameter for writing string into files Issue: IO-182.
o Add new read method "toByteArray" to handle InputStream with known size. Issue: IO-251. Thanks to Marco Albini.
Fixed Bugs:
o Dubious use of mkdirs() return code Issue: IO-280. Thanks to sebb.
o ReaderInputStream enters infinite loop when it encounters an unmappable character Issue: IO-277.
o FileUtils.moveFile() Javadoc should specify FileExistsException thrown Issue: IO-264.
o ClassLoaderObjectInputStream does not handle Proxy classes Issue: IO-260.
o Tailer returning partial lines when reaching EOF before EOL Issue: IO-274. Thanks to Frank Grimes.
o FileUtils.copyFile() throws IOException when copying large files to a shared directory (on Windows) Issue: IO-266. Thanks to Igor Smereka.
o FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.
Improve coverage by also looking for hidden files. Issue: IO-263. Thanks to Gil Adam.
Changes:
o FileAlterationMonitor.stop(boolean allowIntervalToFinish) Issue: IO-259.
==============================================================================
Apache Commons IO Package 2.0.1
==============================================================================
Compatibility with 2.0 and 1.4
------------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 2.0.1 requires a minimum of Java 5
(Commons IO 1.4 had a minimum of Java 1.3)
Enhancements from 2.0
---------------------
* [IO-256] - Provide thread factory for FileAlternationMonitor
Bug fixes from 2.0
------------------
* [IO-257] - BOMInputStream.read(byte[]) can return 0 which it should not
* [IO-258] - XmlStreamReader consumes the stream during encoding detection
==============================================================================
Apache Commons IO Package 2.0
==============================================================================
Compatibility with 1.4
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 2.0 requires a minimum of Java 5
(Commons IO 1.4 had a minimum of Java 1.3)
Deprecations from 1.4
---------------------
- IOUtils
- write(StringBuffer, Writer) in favour of write(CharSequence, Writer)
- write(StringBuffer, OutputStream) in favour of write(CharSequence, OutputStream)
- write(StringBuffer, OutputStream, String) in favour of write(CharSequence, OutputStream, String)
- FileFilterUtils
- andFileFilter(IOFileFilter, IOFileFilter) in favour of and(IOFileFilter...)
- orFileFilter(IOFileFilter, IOFileFilter) in favour of or(IOFileFilter...)
Enhancements from 1.4
---------------------
* [IO-140] Move minimum Java requirement from Java 1.3 to Java 5
- use Generics
- add new CharSequence write() flavour methods to IOUtils and FileUtils
- replace StringBuffer with StringBuilder, where appropriate
- add new Reader/Writer methods to ProxyReader and ProxyWriter
- Annotate with @Override and @Deprecated
* [IO-178] New BOMInputStream and ByteOrderMark implementations - to detect and optionally exclude an initial Byte Order mark (BOM)
* [IO-197] New BoundedInputStream (copied from from Apache JackRabbit)
* [IO-193] New Broken Input and Output streams
* [IO-132] New File Listener/Monitor facility
* [IO-158] New ReaderInputStream and WriterOutputStream implementations
* [IO-139] New StringBuilder Writer implementation
* [IO-192] New Tagged Input and Output streams
* [IO-177] New Tailer class - simple implementation of the Unix "tail -f" functionality
* [IO-162] New XML Stream Reader/Writer implementations (from ROME via plexus-utils)
* [IO-142] Comparators - add facility to sort file lists/arrays
* [IO-186] Comparators - new Composite and Directory File Comparator implementations
* [IO-176] DirectoryWalker - add filterDirectoryContents() callback method for filtering directory contents
* [IO-210] FileFilter - new Magic Number FileFilter
* [IO-221] FileFilterUtils - add methods for suffix and prefix filters which take an IOCase object
* [IO-232] FileFilterUtils - add method for name filters which take an IOCase object
* [IO-229] FileFilterUtils - add varargs and() and or() methods
* [IO-198] FileFilterUtils - add ability to apply file filters to collections and arrays
* [IO-156] FilenameUtils - add normalize() and normalizeNoEndSeparator() methods which allow the separator character to be specified
* [IO-194] FileSystemUtils - add freeSpaceKb() method with no input arguments
* [IO-185] FileSystemUtils - add freeSpaceKb() methods that take a timeout parameter - fixes freeSpaceWindows() blocks
* [IO-155] FileUtils - use NIO to copy files
* [IO-168] FileUtils - add new isSymlink() method
* [IO-219] FileUtils - throw FileExistsException when moving a file or directory if the destination already exists
* [IO-234] FileUtils - add Methods for retrieving System User/Temp directories/paths
* [IO-208] FileUtils - add timeout (connection and read) support for copyURLToFile() method
* [IO-238] FileUtils - add sizeOf(File) method
* [IO-181] LineIterator now implements Iterable
* [IO-224] IOUtils - add closeQuietly(Closeable) and closeQuietly(Socket) methods
* [IO-203] IOUtils - add skipFully() method for InputStreams
* [IO-137] IOUtils and ByteArrayOutputStream - add toBufferedInputStream() method to avoid unnecessary array allocation/copy
* [IO-195] Proxy streams/Reader/Writer - provide exception handling methods
* [IO-211] Proxy Input/Output streams - add pre/post processing support
* [IO-242] Proxy Reader/Writer - add pre/post processing support
Bug fixes from 1.4
------------------
* [IO-214] ByteArrayOutputStream - fix inconsistent synchronization of fields
* [IO-201] Counting Input/Output streams - fix inconsistent synchronization
* [IO-159] FileCleaningTracker - fix remove() never returns null
* [IO-220] FileCleaningTracker - fix Vector performs badly under load
* [IO-167] FilenameUtils - fix case-insensitive string handling in FilenameUtils and FilesystemUtils
* [IO-179] FilenameUtils - fix StringIndexOutOfBounds exception in getPathNoEndSeparator()
* [IO-248] FilenameUtils - fix getFullPathNoEndSeparator() returns empty while path is a one level directory
* [IO-246] FilenameUtils - fix wildcardMatch gives incorrect results
* [IO-187] FileSystemUtils - fix freeSpaceKb() doesn't work with relative paths on Linux
* [IO-160] FileSystemUtils - fix freeSpace() fails on solaris
* [IO-209] FileSystemUtils - fix freeSpaceKb() fails to return correct size for a windows mount point
* [IO-163] FileUtils - fix toURLs() using deprecated method of conversion to URL
* [IO-168] FileUtils - fix Symbolic links followed when deleting directory
* [IO-231] FileUtils - fix wrong exception message generated in isFileNewer() method
* [IO-207] FileUtils - fix race condition in forceMkdir() method
* [IO-217] FileUtils - fix copyDirectoryToDirectory() makes infinite loops
* [IO-166] FileUtils - fix URL decoding in toFile(URL)
* [IO-190] FileUtils - fix copyDirectory not preserving lastmodified date on sub-directories
* [IO-240] FileFilterUtils - ensure cvsFilter and svnFilter are only created once.
* [IO-175] IOUtils - fix copyFile() issues with very large files
* [IO-191] Improvements from static analysis
* [IO-216] LockableFileWriter - delete files quietly when an exception is thrown during initialization
* [IO-243] SwappedDataInputStream - fix readBoolean is inverted
* [IO-235] Tests - remove unused YellOnFlushAndCloseOutputStream from CopyUtilsTest
* [IO-161] Tests - fix FileCleaningTrackerTestCase hanging
Documentation changes from 1.4
------------------------------
* [IO-183 FilenameUtils.getExtension() method documentation improvements
* [IO-226 FileUtils.byteCountToDisplaySize() documentation corrections
* [IO-205 FileUtils.forceMkdir() documentation improvements
* [IO-215 FileUtils copy file/directory improve documentation regarding preserving the last modified date
* [IO-189 HexDump.dump() method documentation improvements
* [IO-171 IOCase document that it assumes there are only two OSes: Windows and Unix
* [IO-223 IOUtils.copy() documentation corrections
* [IO-247 IOUtils.closeQuietly() improve documentation with examples
* [IO-202 NotFileFilter documentation corrections
* [IO-206 ProxyInputStream - fix misleading parameter names
* [IO-212 ProxyInputStream.skip() documentation corrections
==============================================================================
Apache Commons IO Version 1.4
==============================================================================
Compatibility with 1.3.2
------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Commons IO 1.4 introduces four new implementations which depend on Java 4 features
(CharSequenceReader, FileWriterWithEncoding, IOExceptionWithCause and RegexFileFilter).
It has been built with the JDK source and target options set to Java 1.3 and, except for
those implementations, can be used with Java 1.3 (see IO IO-127).
Deprecations from 1.3.2
-----------------------
- FileCleaner deprecated in favour of FileCleaningTracker [see IO-116]
Bug fixes from 1.3.2
--------------------
- FileUtils
- forceDelete of orphaned Softlinks does not work [IO-147]
- Infinite loop on FileUtils.copyDirectory when the destination directory is within
the source directory [IO-141]
- Add a copyDirectory() method that makes use of FileFilter [IO-105]
- Add moveDirectory() and moveFile() methods [IO-77]
- HexDump
- HexDump's use of static StringBuffers isn't thread-safe [IO-136]
Enhancements from 1.3.2
-----------------------
- FileUtils
- Add a deleteQuietly method [IO-135]
- FilenameUtils
- Add file name extension separator constants[IO-149]
- IOExceptionWithCause [IO-148]
- Add a new IOException implementation with constructors which take a cause
- TeeInputStream [IO-129]
- Add new Tee input stream implementation
- FileWriterWithEncoding [IO-153]
- Add new File Writer implementation that accepts an encoding
- CharSequenceReader [IO-138]
- Add new Reader implementation that handles any CharSequence (String,
StringBuffer, StringBuilder or CharBuffer)
- ThesholdingOuputStream [IO-121]
- Add a reset() method which sets the count of the bytes written back to zero.
- DeferredFileOutputStream [IO-130]
- Add support for temporary files
- ByteArrayOutputStream
- Add a new write(InputStream) method [IO-152]
- New Closed Input/Output stream implementations [IO-122]
- AutoCloseInputStream - automatically closes and discards the underlying input stream
- ClosedInputStream - returns -1 for any read attempts
- ClosedOutputStream - throws an IOException for any write attempts
- CloseShieldInputStream - prevents the underlying input stream from being closed.
- CloseShieldOutputStream - prevents the underlying output stream from being closed.
- Add Singleton Constants to several stream classes [IO-143]
- PrefixFileFilter [IO-126]
- Add faciltiy to specify case sensitivity on prefix matching
- SuffixFileFilter [IO-126]
- Add faciltiy to specify case sensitivity on suffix matching
- RegexFileFilter [IO-74]
- Add new regular expression file filter implementation
- Make IOFileFilter implementations Serializable [IO-131]
- Improve IOFileFilter toString() methods [IO-120]
- Make fields final so classes are immutable/threadsafe [IO-133]
- changes to Age, Delegate, Name, Not, Prefix, Regex, Size, Suffix and Wildcard IOFileFilter
implementations.
- IOCase
- Add a compare method to IOCase [IO-144]
- Add a package of java.util.Comparator implementations for files [IO-145]
- DefaultFileComparator - compare files using the default File.compareTo(File) method.
- ExtensionFileComparator - compares files using file name extensions.
- LastModifiedFileComparator - compares files using the last modified date/time.
- NameFileComparator - compares files using file names.
- PathFileComparator - compares files using file paths.
- SizeFileComparator - compares files using file sizes.
==============================================================================
Apache Commons IO Version 1.3.2
==============================================================================
Compatibility with 1.3.1
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Compatibility with 1.3
----------------------
Binary compatible - No
See [IO-113]
Source compatible - No
See [IO-113]
Semantic compatible - Yes
Enhancements since 1.3.1
------------------------
- Created the FileCleaningTracker, basically a non-static version of the
FileCleaner, which can be controlled by the user. [IO-116]
- The FileCleaner is deprecated.
Bug fixes from 1.3.1
--------------------
- Some tests, which are implicitly assuming a Unix-like file system, are
now skipped on Windows. [IO-115]
- EndianUtils
- Both readSwappedUnsignedInteger(...) methods could return negative
numbers due to int/long casting. [IO-117]
Bug fixes from 1.3
------------------
- FileUtils
- NPE in openOutputStream(File) when file has no parent in path [IO-112]
- readFileToString(File) is not static [IO-113]
==============================================================================
Apache Commons IO Version 1.3.1
==============================================================================
Compatibility with 1.3
----------------------
Binary compatible - No
See [IO-113]
Source compatible - No
See [IO-113]
Semantic compatible - Yes
Bug fixes from 1.3
------------------
- FileUtils
- NPE in openOutputStream(File) when file has no parent in path [IO-112]
- readFileToString(File) is not static [IO-113]
==============================================================================
Apache Commons IO Version 1.3
==============================================================================
Compatibility with 1.2
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Check the bug fixes section for semantic bug fixes
Deprecations from 1.2
---------------------
- WildcardFilter deprecated, replaced by WildcardFileFilter
- old class only accepted files, thus had a confusing dual purpose
- FileSystemUtils.freeSpace deprecated, replaced by freeSpaceKb
- freeSpace returns a result that varies by operating system and
thus isn't that useful
- freeSpaceKb returns much better and more consistent results
- freeSpaceKb existed in v1.2, so this is a gentle cutover
Bug fixes from 1.2
------------------
- LineIterator now implements Iterator
- It was always supposed to...
- FileSystemUtils.freeSpace/freeSpaceKb [IO-83]
- These should now work on AIX and HP-UX
- FileSystemUtils.freeSpace/freeSpaceKb [IO-90]
- Avoid infinite looping in Windows
- Catch more errors with nice messages
- FileSystemUtils.freeSpace [IO-91]
- This is now documented not to work on SunOS 5
- FileSystemUtils [IO-93]
- Fixed resource leak leading to 'Too many open files' error
- Previously did not destroy Process instances (as JDK Javadoc is so poor)
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027
- FileUtils.touch [IO-100]
- The touch method previously gave no indication when the file could not
be touched successfully (such as due to access restrictions) - it now
throws an IOException if the last modified date cannot be changed
- FileCleaner
- This now handles the situation where an error occurs when deleting the file
- IOUtils.copy [IO-84]
- Copy methods could return inaccurate byte/char count for large streams
- The copy(InputStream, OutputStream) method now returns -1 if the count is greater than an int
- The copy(Reader, Writer) method now throws now returns -1 if the count is greater than an int
- Added a new copyLarge(InputStream, OutputStream) method that returns a long
- Added a new copyLarge(Reader, Writer) method that returns a long
- CountingInputStream/CountingOutputStream [IO-84]
- Methods were declared as int thus the count was innacurate for large streams
- new long based methods getByteCount()/resetByteCount() added
- existing methods changed to throw an exception if the count is greater than an int
- FileBasedTestCase
- Fixed bug in compare content methods identified by GNU classpath
- EndianUtils.writeSwappedLong(byte[], int) [IO-101]
- An int overrun in the bit shifting when it should have been a long
- EndianUtils.writeSwappedLong(InputStream) [IO-102]
- The return of input.read(byte[]) was not being checked to ensure all 8 bytes were read
Enhancements from 1.2
---------------------
- DirectoryWalker [IO-86]
- New class designed for subclassing to walk through a set of files.
DirectoryWalker provides the walk of the directories, filtering of
directories and files, and cancellation support. The subclass must provide
the specific behavior, such as text searching or image processing.
- IOCase
- New class/enumeration for case-sensitivity control
- FilenameUtils
- New methods to handle case-sensitivity
- wildcardMatch - new method that has IOCase as a parameter
- equals - new method that has IOCase as a parameter
- FileUtils [IO-108] - new default encoding methods for:
- readFileToString(File)
- readLines(File)
- lineIterator(File)
- writeStringToFile(File, String)
- writeLines(File, Collection)
- writeLines(File, Collection, String)
- FileUtils.openOutputStream [IO-107]
- new method to open a FileOutputStream, creating parent directories if required
- FileUtils.touch
- FileUtils.copyURLToFile
- FileUtils.writeStringToFile
- FileUtils.writeByteArrayToFile
- FileUtils.writeLines
- enhanced to create parent directories if required
- FileUtils.openInputStream [IO-107]
- new method to open a FileInputStream, providing better error messages than the JDK
- FileUtils.isFileOlder
- new methods to check if a file is older (i.e. isFileOlder()) - counterparts
to the existing isFileNewer() methods.
- FileUtils.checksum, FileUtils.checksumCRC32
- new methods to create a checksum of a file
- FileUtils.copyFileToDirectory [IO-104]
- new variant that optionally retains the file date
- FileDeleteStrategy
- FileCleaner [IO-56,IO-70]
- FileDeleteStrategy is a strategy for handling file deletion
- This can be used as a calback in FileCleaner
- Together these allow FileCleaner to do a forceDelete to kill directories
- FileCleaner.exitWhenFinished [IO-99]
- A new method that allows the internal cleaner thread to be cleanly terminated
- WildcardFileFilter
- Replacement for WildcardFilter
- Accepts both files and directories
- Ability to control case-sensitivity
- NameFileFilter
- Ability to control case-sensitivity
- FileFileFilter
- New IOFileFilter implementation
- Accepts files where File.isFile() is true
- In other words it filters out directories
- Singleton instance provided (FILE)
- CanReadFileFilter
- New IOFileFilter implementation
- Accepts files where File.canRead() is true
- Singleton instances provided (CAN_READ/CANNOT_READ/READ_ONLY)
- CanWriteFileFilter
- New IOFileFilter implementation
- Accepts files where File.canWrite() is true
- Singleton instances provided (CAN_WRITE/CANNOT_WRITE)
- HiddenFileFilter
- New IOFileFilter implementation
- Accepts files where File.isHidden() is true
- Singleton instances provided (HIDDEN/VISIBLE)
- EmptyFileFilter
- New IOFileFilter implementation
- Accepts files or directories that are empty
- Singleton instances provided (EMPTY/NOT_EMPTY)
- TrueFileFilter/FalseFileFilter/DirectoryFileFilter
- New singleton instance constants (TRUE/FALSE/DIRECTORY)
- The new constants are more Java 5 friendly with regards to static imports
(whereas if everything uses INSTANCE, then they just clash)
- The old INSTANCE constants are still present and have not been deprecated
- FileFilterUtils.sizeRangeFileFilter
- new sizeRangeFileFilter(long minimumSize, long maximumSize) method which
creates a filter that accepts files within the specified size range.
- FileFilterUtils.makeDirectoryOnly/makeFileOnly
- two new methods that decorate a file filter to make it apply to
directories only or files only
- NullWriter
- New writer that acts as a sink for all data, as per /dev/null
- NullInputStream
- New input stream that emulates a stream of a specified size
- NullReader
- New reader that emulates a reader of a specified size
- ByteArrayOutputStream [IO-97]
- Performance enhancements
==============================================================================
Apache Commons IO Version 1.2
==============================================================================
Compatibility with 1.1
----------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Deprecations from 1.1
---------------------
Bug fixes from 1.1
------------------
- FileSystemUtils.freeSpace(drive)
Fix to allow Windows based command to function in French locale
- FileUtils.read*
Increase certainty that files are closed in case of error
- LockableFileWriter
Locking mechanism was broken and only provided limited protection [38942]
File deletion and locking in case of constructor error was broken
Enhancements from 1.1
---------------------
- AgeFileFilter/SizeFileFilter
New file filters that compares against the age and size of the file
- FileSystemUtils.freeSpaceKb(drive)
New method that unifies result to be in kilobytes [38574]
- FileUtils.contentEquals(File,File)
Performance improved by adding length and file location checking
- FileUtils.iterateFiles
Two new method to provide direct access to iterators over files
- FileUtils.lineIterator
IOUtils.lineIterator
New methods to provide an iterator over the lines in a file [38083]
- FileUtils.copyDirectoryToDirectory
New method to copy a directory to within another directory [36315]
==============================================================================
Apache Commons IO Version 1.1
==============================================================================
Incompatible changes from 1.0
-----------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes, except:
- FileUtils.writeStringToFile()
A null encoding previously used 'ISO-8859-1', now it uses the platform default
Generally this will make no difference
- LockableFileWriter
Improved validation and now create directories if necesssary
plus these bug fixes may affect you semantically:
- FileUtils.touch() (Bug fix 29821)
Now creates the file if it did not previously exist
- FileUtils.toFile(URL) (Bug fix 32575)
Now handles escape syntax such as %20
- FileUtils.sizeOfDirectory() (Bug fix 36801)
May now return a size of 0 if the directory is security restricted
Deprecations from 1.0
---------------------
- CopyUtils has been deprecated.
Its methods have been moved to IOUtils.
The new IOUtils methods handle nulls better, and have clearer names.
- IOUtils.toByteArray(String) - Use {@link String#getBytes()}
- IOUtils.toString(byte[]) - Use {@link String#String(byte[])}
- IOUtils.toString(byte[],String) - Use {@link String#String(byte[],String)}
Bug fixes from 1.0
------------------
- FileUtils - touch() [29821]
Now creates the file if it did not previously exist
- FileUtils - toFile(URL) [32575]
Now handles escape syntax such as %20
- FileFilterUtils - makeCVSAware(IOFileFilter) [33023]
Fixed bug that caused method to be completely broken
- CountingInputStream [33336]
Fixed bug that caused the count to reduce by one at the end of the stream
- CountingInputStream - skip(long) [34311]
Bytes from calls to this method were not previously counted
- NullOutputStream [33481]
Remove unnecessary synchronization
- AbstractFileFilter - accept(File, String) [30992]
Fixed broken implementation
- FileUtils [36801]
Previously threw NPE when listing files in a security restricted directory
Now throw IOException with a better message
- FileUtils - writeStringToFile()
Null encoding now correctly uses the platform default
Enhancements from 1.0
---------------------
- FilenameUtils - new class [33303,29351]
A static utility class for working with filenames
Seeks to ease the pain of developing on Windows and deploying on Unix
- FileSystemUtils - new class [32982,36325]
A static utility class for working with file systems
Provides one method at present, to get the free space on the filing system
- IOUtils - new public constants
Constants for directory and line separators on Windows and Unix
- IOUtils - toByteArray(Reader,encoding)
Handles encodings when reading to a byte array
- IOUtils - toCharArray(InputStream) [28979]
- toCharArray(InputStream,encoding)
- toCharArray(Reader)
Reads a stream/reader into a charatcter array
- IOUtils - readLines(InputStream) [36214]
- readLines(InputStream,encoding)
- readLines(Reader)
Reads a stream/reader line by line into a List of Strings
- IOUtils - toInputStream(String) [32958]
- toInputStream(String,encoding)
Creates an input stream that uses the string as a source of data
- IOUtils - writeLines(Collection,lineEnding,OutputStream) [36214]
- writeLines(Collection,lineEnding,OutputStream,encoding)
- writeLines(Collection,lineEnding,Writer)
Writes a collection to a stream/writer line by line
- IOUtils - write(...)
Write data to a stream/writer (moved from CopyUtils with better null handling)
- IOUtils - copy(...)
Copy data between streams (moved from CopyUtils with better null handling)
- IOUtils - contentEquals(Reader,Reader)
Method to compare the contents of two readers
- FileUtils - toFiles(URL[])
Converts an array of URLs to an array of Files
- FileUtils - copyDirectory() [32944]
New methods to copy a directory
- FileUtils - readFileToByteArray(File)
Reads an entire file into a byte array
- FileUtils - writeByteArrayToFile(File,byte[])
Writes a byte array to a file
- FileUtils - readLines(File,encoding) [36214]
Reads a file line by line into a List of Strings
- FileUtils - writeLines(File,encoding,List)
writeLines(File,encoding,List,lineEnding)
Writes a collection to a file line by line
- FileUtils - EMPTY_FILE_ARRAY
Constant for an empty array of File objects
- ConditionalFileFilter - new interface [30705]
Defines the behavior of list based filters
- AndFileFilter, OrFileFilter [30705]
Now support a list of filters to and/or
- WildcardFilter [31115]
New filter that can match using wildcard file names
- FileFilterUtils - makeSVNAware(IOFileFilter)
New method, like makeCVSAware, that ignores Subversion source control directories
- ClassLoaderObjectInputStream
An ObjectInputStream that supports a ClassLoader
- CountingInputStream,CountingOutputStream - resetCount() [28976]
Adds the ability to reset the count part way through reading/writing the stream
- DeferredFileOutputStream - writeTo(OutputStream) [34173]
New method to allow current contents to be written to a stream
- DeferredFileOutputStream [34142]
Performance optimizations avoiding double buffering
- LockableFileWriter - encoding support [36825]
Add support for character encodings to LockableFileWriter
Improve the validation
Create directories if necesssary
- IOUtils and EndianUtils are no longer final [28978]
Allows developers to have subclasses if desired
==============================================================================
Feedback
==============================================================================
Open source works best when you give feedback:
https://commons.apache.org/io/
Please direct all bug reports to JIRA
https://issues.apache.org/jira/browse/IO
Or subscribe to the commons-user mailing list (prefix emails by [io])
https://commons.apache.org/mail-lists.html
The Commons-IO Team
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/ByteOrderMark.java 0100644 0000000 0000000 00000013454 13612062727 027117 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.io.Serializable;
import java.util.Locale;
/**
* Byte Order Mark (BOM) representation - see {@link org.apache.commons.io.input.BOMInputStream}.
*
* @see org.apache.commons.io.input.BOMInputStream
* @see Wikipedia: Byte Order Mark
* @see W3C: Autodetection of Character Encodings
* (Non-Normative)
* @since 2.0
*/
public class ByteOrderMark implements Serializable {
private static final long serialVersionUID = 1L;
/** UTF-8 BOM. */
public static final ByteOrderMark UTF_8 = new ByteOrderMark("UTF-8", 0xEF, 0xBB, 0xBF);
/** UTF-16BE BOM (Big-Endian). */
public static final ByteOrderMark UTF_16BE = new ByteOrderMark("UTF-16BE", 0xFE, 0xFF);
/** UTF-16LE BOM (Little-Endian). */
public static final ByteOrderMark UTF_16LE = new ByteOrderMark("UTF-16LE", 0xFF, 0xFE);
/**
* UTF-32BE BOM (Big-Endian).
*
* @since 2.2
*/
public static final ByteOrderMark UTF_32BE = new ByteOrderMark("UTF-32BE", 0x00, 0x00, 0xFE, 0xFF);
/**
* UTF-32LE BOM (Little-Endian).
*
* @since 2.2
*/
public static final ByteOrderMark UTF_32LE = new ByteOrderMark("UTF-32LE", 0xFF, 0xFE, 0x00, 0x00);
/**
* Unicode BOM character; external form depends on the encoding.
*
* @see Byte Order Mark (BOM) FAQ
* @since 2.5
*/
public static final char UTF_BOM = '\uFEFF';
private final String charsetName;
private final int[] bytes;
/**
* Constructs a new BOM.
*
* @param charsetName The name of the charset the BOM represents
* @param bytes The BOM's bytes
* @throws IllegalArgumentException if the charsetName is null or
* zero length
* @throws IllegalArgumentException if the bytes are null or zero
* length
*/
public ByteOrderMark(final String charsetName, final int... bytes) {
if (charsetName == null || charsetName.isEmpty()) {
throw new IllegalArgumentException("No charsetName specified");
}
if (bytes == null || bytes.length == 0) {
throw new IllegalArgumentException("No bytes specified");
}
this.charsetName = charsetName;
this.bytes = new int[bytes.length];
System.arraycopy(bytes, 0, this.bytes, 0, bytes.length);
}
/**
* Gets the name of the {@link java.nio.charset.Charset} the BOM represents.
*
* @return the character set name
*/
public String getCharsetName() {
return charsetName;
}
/**
* Gets the length of the BOM's bytes.
*
* @return the length of the BOM's bytes
*/
public int length() {
return bytes.length;
}
/**
* Gets the byte at the specified position.
*
* @param pos The position
* @return The specified byte
*/
public int get(final int pos) {
return bytes[pos];
}
/**
* Gets a copy of the BOM's bytes.
*
* @return a copy of the BOM's bytes
*/
public byte[] getBytes() {
final byte[] copy = IOUtils.byteArray(bytes.length);
for (int i = 0; i < bytes.length; i++) {
copy[i] = (byte)bytes[i];
}
return copy;
}
/**
* Indicates if this BOM's bytes equals another.
*
* @param obj The object to compare to
* @return true if the bom's bytes are equal, otherwise
* false
*/
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof ByteOrderMark)) {
return false;
}
final ByteOrderMark bom = (ByteOrderMark)obj;
if (bytes.length != bom.length()) {
return false;
}
for (int i = 0; i < bytes.length; i++) {
if (bytes[i] != bom.get(i)) {
return false;
}
}
return true;
}
/**
* Computes the hashcode for this BOM.
*
* @return the hashcode for this BOM.
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int hashCode = getClass().hashCode();
for (final int b : bytes) {
hashCode += b;
}
return hashCode;
}
/**
* Converts this instance to a String representation of the BOM.
*
* @return the length of the BOM's bytes
*/
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append(getClass().getSimpleName());
builder.append('[');
builder.append(charsetName);
builder.append(": ");
for (int i = 0; i < bytes.length; i++) {
if (i > 0) {
builder.append(",");
}
builder.append("0x");
builder.append(Integer.toHexString(0xFF & bytes[i]).toUpperCase(Locale.ROOT));
}
builder.append(']');
return builder.toString();
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/ByteOrderParser.java 0100644 0000000 0000000 00000004720 13612062727 027455 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.nio.ByteOrder;
/**
* Converts Strings to {@link ByteOrder} instances.
*
* @since 2.6
*/
public final class ByteOrderParser {
/**
* ByteOrderUtils is a static utility class, so prevent construction with a private constructor.
*/
private ByteOrderParser() {
}
/**
* Parses the String argument as a {@link ByteOrder}.
*
* Returns {@code ByteOrder.LITTLE_ENDIAN} if the given value is {@code "LITTLE_ENDIAN"}.
*
*
* Returns {@code ByteOrder.BIG_ENDIAN} if the given value is {@code "BIG_ENDIAN"}.
*
*
* @param value
* the {@code String} containing the ByteOrder representation to be parsed
* @return the ByteOrder represented by the string argument
* @throws IllegalArgumentException
* if the {@code String} containing the ByteOrder representation to be parsed is unknown.
*/
public static ByteOrder parseByteOrder(final String value) {
if (ByteOrder.BIG_ENDIAN.toString().equals(value)) {
return ByteOrder.BIG_ENDIAN;
}
if (ByteOrder.LITTLE_ENDIAN.toString().equals(value)) {
return ByteOrder.LITTLE_ENDIAN;
}
throw new IllegalArgumentException("Unsupported byte order setting: " + value + ", expected one of " + ByteOrder.LITTLE_ENDIAN +
", " + ByteOrder.BIG_ENDIAN);
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/Charsets.java 0100644 0000000 0000000 00000020050 13612062727 026147 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* Charsets required of every implementation of the Java platform.
*
* From the Java documentation
* Standard charsets:
*
* Every implementation of the Java platform is required to support the following character encodings. Consult
* the release documentation for your implementation to see if any other encodings are supported. Consult the release
* documentation for your implementation to see if any other encodings are supported.
*
*
*
*
{@code US-ASCII}
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.
*
{@code ISO-8859-1}
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
{@code UTF-16BE}
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
*
{@code UTF-16LE}
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
*
{@code UTF-16}
* Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
* accepted on input, big-endian used on output.)
*
*
* @see Standard charsets
* @since 2.3
*/
public class Charsets {
//
// This class should only contain Charset instances for required encodings. This guarantees that it will load
// correctly and without delay on all Java platforms.
//
private static final SortedMap STANDARD_CHARSET_MAP;
static {
final SortedMap standardCharsetMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
standardCharsetMap.put(StandardCharsets.ISO_8859_1.name(), StandardCharsets.ISO_8859_1);
standardCharsetMap.put(StandardCharsets.US_ASCII.name(), StandardCharsets.US_ASCII);
standardCharsetMap.put(StandardCharsets.UTF_16.name(), StandardCharsets.UTF_16);
standardCharsetMap.put(StandardCharsets.UTF_16BE.name(), StandardCharsets.UTF_16BE);
standardCharsetMap.put(StandardCharsets.UTF_16LE.name(), StandardCharsets.UTF_16LE);
standardCharsetMap.put(StandardCharsets.UTF_8.name(), StandardCharsets.UTF_8);
STANDARD_CHARSET_MAP = Collections.unmodifiableSortedMap(standardCharsetMap);
}
/**
* Constructs a sorted map from canonical charset names to charset objects required of every implementation of the
* Java platform.
*
*
* @return An immutable, case-insensitive map from canonical charset names to charset objects.
* @see Charset#availableCharsets()
* @since 2.5
*/
public static SortedMap requiredCharsets() {
return STANDARD_CHARSET_MAP;
}
/**
* Returns the given Charset or the default Charset if the given Charset is null.
*
* @param charset
* A charset or null.
* @return the given Charset or the default Charset if the given Charset is null
*/
public static Charset toCharset(final Charset charset) {
return charset == null ? Charset.defaultCharset() : charset;
}
/**
* Returns a Charset for the named charset. If the name is null, return the default Charset.
*
* @param charsetName The name of the requested charset, may be null.
* @return a Charset for the named charset.
* @throws UnsupportedCharsetException If the named charset is unavailable (unchecked exception).
*/
public static Charset toCharset(final String charsetName) throws UnsupportedCharsetException {
return charsetName == null ? Charset.defaultCharset() : Charset.forName(charsetName);
}
/**
* CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
/**
*
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
*
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset US_ASCII = StandardCharsets.US_ASCII;
/**
*
* Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
* (either order accepted on input, big-endian used on output)
*
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset UTF_16 = StandardCharsets.UTF_16;
/**
*
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
*
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset UTF_16BE = StandardCharsets.UTF_16BE;
/**
*
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
*
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset UTF_16LE = StandardCharsets.UTF_16LE;
/**
*
* Eight-bit Unicode Transformation Format.
*
*
* Every implementation of the Java platform is required to support this character encoding.
*
*
* @see Standard charsets
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
*/
@Deprecated
public static final Charset UTF_8 = StandardCharsets.UTF_8;
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/CopyUtils.java 0100644 0000000 0000000 00000035146 13612062727 026342 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import static org.apache.commons.io.IOUtils.EOF;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
import java.nio.charset.Charset;
/**
* This class provides static utility methods for buffered
* copying between sources ({@code InputStream}, {@code Reader},
* {@code String} and {@code byte[]}) and destinations
* ({@code OutputStream}, {@code Writer}, {@code String} and
* {@code byte[]}).
*
* Unless otherwise noted, these {@code copy} methods do not
* flush or close the streams. Often doing so would require making non-portable
* assumptions about the streams' origin and further use. This means that both
* streams' {@code close()} methods must be called after copying. if one
* omits this step, then the stream resources (sockets, file descriptors) are
* released when the associated Stream is garbage-collected. It is not a good
* idea to rely on this mechanism. For a good overview of the distinction
* between "memory management" and "resource management", see
* this
* UnixReview article.
*
* For byte-to-char methods, a {@code copy} variant allows the encoding
* to be selected (otherwise the platform default is used). We would like to
* encourage you to always specify the encoding because relying on the platform
* default can lead to unexpected results.
*
* We don't provide special variants for the {@code copy} methods that
* let you specify the buffer size because in modern VMs the impact on speed
* seems to be minimal. We're using a default buffer size of 4 KB.
*
* The {@code copy} methods use an internal buffer when copying. It is
* therefore advisable not to deliberately wrap the stream arguments
* to the {@code copy} methods in {@code Buffered*} streams. For
* example, don't do the following:
*
* copy( new BufferedInputStream( in ), new BufferedOutputStream( out ) );
*
* The rationale is as follows:
*
* Imagine that an InputStream's read() is a very expensive operation, which
* would usually suggest wrapping in a BufferedInputStream. The
* BufferedInputStream works by issuing infrequent
* {@link java.io.InputStream#read(byte[] b, int off, int len)} requests on the
* underlying InputStream, to fill an internal buffer, from which further
* {@code read} requests can inexpensively get their data (until the buffer
* runs out).
*
* However, the {@code copy} methods do the same thing, keeping an
* internal buffer, populated by
* {@link InputStream#read(byte[] b, int off, int len)} requests. Having two
* buffers (or three if the destination stream is also buffered) is pointless,
* and the unnecessary buffer management hurts performance slightly (about 3%,
* according to some simple experiments).
*
* Behold, intrepid explorers; a map of this class:
*
* Note that only the first two methods shuffle bytes; the rest use these
* two, or (if possible) copy using native Java copy methods. As there are
* method variants to specify the encoding, each row may
* correspond to up to 2 methods.
*
* Origin of code: Excalibur.
*
* @deprecated Use IOUtils. Will be removed in 3.0.
* Methods renamed to IOUtils.write() or IOUtils.copy().
* Null handling behavior changed in IOUtils (null data does not
* throw NullPointerException).
*/
@Deprecated
public class CopyUtils {
/**
* Instances should NOT be constructed in standard programming.
*/
public CopyUtils() { }
/**
* Copies bytes from a {@code byte[]} to an {@code OutputStream}.
* @param input the byte array to read from
* @param output the {@code OutputStream} to write to
* @throws IOException In case of an I/O problem
*/
public static void copy(final byte[] input, final OutputStream output) throws IOException {
output.write(input);
}
/**
* Copies and convert bytes from a {@code byte[]} to chars on a
* {@code Writer}.
* The platform's default encoding is used for the byte-to-char conversion.
* @param input the byte array to read from
* @param output the {@code Writer} to write to
* @throws IOException In case of an I/O problem
* @deprecated 2.5 use {@link #copy(byte[], Writer, String)} instead
*/
@Deprecated
public static void copy(final byte[] input, final Writer output) throws IOException {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
copy(inputStream, output);
}
/**
* Copies and convert bytes from a {@code byte[]} to chars on a
* {@code Writer}, using the specified encoding.
* @param input the byte array to read from
* @param output the {@code Writer} to write to
* @param encoding The name of a supported character encoding. See the
* IANA
* Charset Registry for a list of valid encoding types.
* @throws IOException In case of an I/O problem
*/
public static void copy(final byte[] input, final Writer output, final String encoding) throws IOException {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
copy(inputStream, output, encoding);
}
/**
* Copies bytes from an {@code InputStream} to an
* {@code OutputStream}.
* @param input the {@code InputStream} to read from
* @param output the {@code OutputStream} to write to
* @return the number of bytes copied
* @throws IOException In case of an I/O problem
*/
public static int copy(final InputStream input, final OutputStream output) throws IOException {
final byte[] buffer = IOUtils.byteArray();
int count = 0;
int n;
while (EOF != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
}
return count;
}
// ----------------------------------------------------------------
// Reader -> Writer
// ----------------------------------------------------------------
/**
* Copies chars from a {@code Reader} to a {@code Writer}.
* @param input the {@code Reader} to read from
* @param output the {@code Writer} to write to
* @return the number of characters copied
* @throws IOException In case of an I/O problem
*/
public static int copy(
final Reader input,
final Writer output)
throws IOException {
final char[] buffer = IOUtils.getCharArray();
int count = 0;
int n;
while (EOF != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
}
return count;
}
// ----------------------------------------------------------------
// InputStream -> Writer
// ----------------------------------------------------------------
/**
* Copies and convert bytes from an {@code InputStream} to chars on a
* {@code Writer}.
* The platform's default encoding is used for the byte-to-char conversion.
* @param input the {@code InputStream} to read from
* @param output the {@code Writer} to write to
* @throws IOException In case of an I/O problem
* @deprecated 2.5 use {@link #copy(InputStream, Writer, String)} instead
*/
@Deprecated
public static void copy(
final InputStream input,
final Writer output)
throws IOException {
// make explicit the dependency on the default encoding
final InputStreamReader in = new InputStreamReader(input, Charset.defaultCharset());
copy(in, output);
}
/**
* Copies and convert bytes from an {@code InputStream} to chars on a
* {@code Writer}, using the specified encoding.
* @param input the {@code InputStream} to read from
* @param output the {@code Writer} to write to
* @param encoding The name of a supported character encoding. See the
* IANA
* Charset Registry for a list of valid encoding types.
* @throws IOException In case of an I/O problem
*/
public static void copy(
final InputStream input,
final Writer output,
final String encoding)
throws IOException {
final InputStreamReader in = new InputStreamReader(input, encoding);
copy(in, output);
}
// ----------------------------------------------------------------
// Reader -> OutputStream
// ----------------------------------------------------------------
/**
* Serialize chars from a {@code Reader} to bytes on an
* {@code OutputStream}, and flush the {@code OutputStream}.
* Uses the default platform encoding.
* @param input the {@code Reader} to read from
* @param output the {@code OutputStream} to write to
* @throws IOException In case of an I/O problem
* @deprecated 2.5 use {@link #copy(Reader, OutputStream, String)} instead
*/
@Deprecated
public static void copy(
final Reader input,
final OutputStream output)
throws IOException {
// make explicit the dependency on the default encoding
final OutputStreamWriter out = new OutputStreamWriter(output, Charset.defaultCharset());
copy(input, out);
// XXX Unless anyone is planning on rewriting OutputStreamWriter, we
// have to flush here.
out.flush();
}
/**
* Serialize chars from a {@code Reader} to bytes on an
* {@code OutputStream}, and flush the {@code OutputStream}.
* @param input the {@code Reader} to read from
* @param output the {@code OutputStream} to write to
* @param encoding The name of a supported character encoding. See the
* IANA
* Charset Registry for a list of valid encoding types.
* @throws IOException In case of an I/O problem
* @since 2.5
*/
public static void copy(
final Reader input,
final OutputStream output,
final String encoding)
throws IOException {
final OutputStreamWriter out = new OutputStreamWriter(output, encoding);
copy(input, out);
// XXX Unless anyone is planning on rewriting OutputStreamWriter, we
// have to flush here.
out.flush();
}
// ----------------------------------------------------------------
// String -> OutputStream
// ----------------------------------------------------------------
/**
* Serialize chars from a {@code String} to bytes on an
* {@code OutputStream}, and
* flush the {@code OutputStream}.
* Uses the platform default encoding.
* @param input the {@code String} to read from
* @param output the {@code OutputStream} to write to
* @throws IOException In case of an I/O problem
* @deprecated 2.5 use {@link #copy(String, OutputStream, String)} instead
*/
@Deprecated
public static void copy(
final String input,
final OutputStream output)
throws IOException {
final StringReader in = new StringReader(input);
// make explicit the dependency on the default encoding
final OutputStreamWriter out = new OutputStreamWriter(output, Charset.defaultCharset());
copy(in, out);
// XXX Unless anyone is planning on rewriting OutputStreamWriter, we
// have to flush here.
out.flush();
}
/**
* Serialize chars from a {@code String} to bytes on an
* {@code OutputStream}, and
* flush the {@code OutputStream}.
* @param input the {@code String} to read from
* @param output the {@code OutputStream} to write to
* @param encoding The name of a supported character encoding. See the
* IANA
* Charset Registry for a list of valid encoding types.
* @throws IOException In case of an I/O problem
* @since 2.5
*/
public static void copy(
final String input,
final OutputStream output,
final String encoding)
throws IOException {
final StringReader in = new StringReader(input);
final OutputStreamWriter out = new OutputStreamWriter(output, encoding);
copy(in, out);
// XXX Unless anyone is planning on rewriting OutputStreamWriter, we
// have to flush here.
out.flush();
}
// ----------------------------------------------------------------
// String -> Writer
// ----------------------------------------------------------------
/**
* Copies chars from a {@code String} to a {@code Writer}.
* @param input the {@code String} to read from
* @param output the {@code Writer} to write to
* @throws IOException In case of an I/O problem
*/
public static void copy(final String input, final Writer output)
throws IOException {
output.write(input);
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/DirectoryWalker.java 0100644 0000000 0000000 00000064101 13612062727 027512 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Collection;
import java.util.Objects;
import org.apache.commons.io.file.PathUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
/**
* Abstract class that walks through a directory hierarchy and provides subclasses with convenient hooks to add specific
* behavior.
*
* This class operates with a {@link FileFilter} and maximum depth to limit the files and directories visited. Commons
* IO supplies many common filter implementations in the filefilter
* package.
*
*
* There are many possible extensions, for example, to delete all files and '.svn' directories, and return a list of
* deleted files:
*
*
* public class FileCleaner extends DirectoryWalker {
*
* public FileCleaner() {
* super();
* }
*
* public List clean(File startDirectory) {
* List results = new ArrayList();
* walk(startDirectory, results);
* return results;
* }
*
* protected boolean handleDirectory(File directory, int depth, Collection results) {
* // delete svn directories and then skip
* if (".svn".equals(directory.getName())) {
* directory.delete();
* return false;
* } else {
* return true;
* }
*
* }
*
* protected void handleFile(File file, int depth, Collection results) {
* // delete file and add to list of deleted
* file.delete();
* results.add(file);
* }
* }
*
*
*
2. Filter Example
*
*
* Choosing which directories and files to process can be a key aspect of using this class. This information can be
* setup in three ways, via three different constructors.
*
*
* The first option is to visit all directories and files. This is achieved via the no-args constructor.
*
*
* The second constructor option is to supply a single {@link FileFilter} that describes the files and directories to
* visit. Care must be taken with this option as the same filter is used for both directories and files.
*
*
* For example, if you wanted all directories which are not hidden and files which end in ".txt":
*
*
*
* public class FooDirectoryWalker extends DirectoryWalker {
* public FooDirectoryWalker(FileFilter filter) {
* super(filter, -1);
* }
* }
*
* // Build up the filters and create the walker
* // Create a filter for Non-hidden directories
* IOFileFilter fooDirFilter = FileFilterUtils.andFileFilter(FileFilterUtils.directoryFileFilter,
* HiddenFileFilter.VISIBLE);
*
* // Create a filter for Files ending in ".txt"
* IOFileFilter fooFileFilter = FileFilterUtils.andFileFilter(FileFilterUtils.fileFileFilter,
* FileFilterUtils.suffixFileFilter(".txt"));
*
* // Combine the directory and file filters using an OR condition
* java.io.FileFilter fooFilter = FileFilterUtils.orFileFilter(fooDirFilter, fooFileFilter);
*
* // Use the filter to construct a DirectoryWalker implementation
* FooDirectoryWalker walker = new FooDirectoryWalker(fooFilter);
*
*
* The third constructor option is to specify separate filters, one for directories and one for files. These are
* combined internally to form the correct {@code FileFilter}, something which is very easy to get wrong when
* attempted manually, particularly when trying to express constructs like 'any file in directories named docs'.
*
*
* For example, if you wanted all directories which are not hidden and files which end in ".txt":
*
*
*
* public class FooDirectoryWalker extends DirectoryWalker {
* public FooDirectoryWalker(IOFileFilter dirFilter, IOFileFilter fileFilter) {
* super(dirFilter, fileFilter, -1);
* }
* }
*
* // Use the filters to construct the walker
* FooDirectoryWalker walker = new FooDirectoryWalker(
* HiddenFileFilter.VISIBLE,
* FileFilterUtils.suffixFileFilter(".txt"),
* );
*
*
* This is much simpler than the previous example, and is why it is the preferred option for filtering.
*
*
*
3. Cancellation
*
*
* The DirectoryWalker contains some of the logic required for cancel processing. Subclasses must complete the
* implementation.
*
*
* What {@code DirectoryWalker} does provide for cancellation is:
*
*
*
{@link CancelException} which can be thrown in any of the lifecycle methods to stop processing.
*
The {@code walk()} method traps thrown {@link CancelException} and calls the {@code handleCancelled()}
* method, providing a place for custom cancel processing.
*
*
* Implementations need to provide:
*
*
*
The decision logic on whether to cancel processing or not.
*
Constructing and throwing a {@link CancelException}.
*
Custom cancel processing in the {@code handleCancelled()} method.
*
*
* Two possible scenarios are envisaged for cancellation:
*
3.2 Internal - cancellation being decided/initiated from within a DirectoryWalker
* implementation.
*
*
* The following sections provide example implementations for these two different scenarios.
*
*
*
3.1 External / Multi-threaded
*
*
* This example provides a public {@code cancel()} method that can be called by another thread to stop the
* processing. A typical example use-case would be a cancel button on a GUI. Calling this method sets a
* volatile flag to ensure
* it will work properly in a multi-threaded environment. The flag is returned by the {@code handleIsCancelled()}
* method, which will cause the walk to stop immediately. The {@code handleCancelled()} method will be the next,
* and last, callback method received once cancellation has occurred.
*
* This shows an example of how internal cancellation processing could be implemented. Note the decision logic
* and throwing a {@link CancelException} could be implemented in any of the lifecycle methods.
*
*
*
* public class BarDirectoryWalker extends DirectoryWalker {
*
* protected boolean handleDirectory(File directory, int depth, Collection results) throws IOException {
* // cancel if hidden directory
* if (directory.isHidden()) {
* throw new CancelException(file, depth);
* }
* return true;
* }
*
* protected void handleFile(File file, int depth, Collection results) throws IOException {
* // cancel if read-only file
* if (!file.canWrite()) {
* throw new CancelException(file, depth);
* }
* results.add(file);
* }
*
* protected void handleCancelled(File startDirectory, Collection results, CancelException cancel) {
* // implement processing required when a cancellation occurs
* }
* }
*
*
* @param The result type, like {@link File}.
* @since 1.3
* @deprecated Apache Commons IO no longer uses this class. Instead, use
* {@link PathUtils#walk(java.nio.file.Path, org.apache.commons.io.file.PathFilter, int, boolean, java.nio.file.FileVisitOption...)}
* or {@link Files#walkFileTree(java.nio.file.Path, java.util.Set, int, java.nio.file.FileVisitor)}, and
* friends.
*/
@Deprecated
public abstract class DirectoryWalker {
/**
* The file filter to use to filter files and directories.
*/
private final FileFilter filter;
/**
* The limit on the directory depth to walk.
*/
private final int depthLimit;
/**
* Construct an instance with no filtering and unlimited depth.
*/
protected DirectoryWalker() {
this(null, -1);
}
/**
* Constructs an instance with a filter and limit the depth navigated to.
*
* The filter controls which files and directories will be navigated to as
* part of the walk. The {@link FileFilterUtils} class is useful for combining
* various filters together. A {@code null} filter means that no
* filtering should occur and all files and directories will be visited.
*
*
* @param filter the filter to apply, null means visit all files
* @param depthLimit controls how deep the hierarchy is
* navigated to (less than 0 means unlimited)
*/
protected DirectoryWalker(final FileFilter filter, final int depthLimit) {
this.filter = filter;
this.depthLimit = depthLimit;
}
/**
* Constructs an instance with a directory and a file filter and an optional
* limit on the depth navigated to.
*
* The filters control which files and directories will be navigated to as part
* of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
* and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
* A {@code null} filter means that no filtering should occur.
*
*
* @param directoryFilter the filter to apply to directories, null means visit all directories
* @param fileFilter the filter to apply to files, null means visit all files
* @param depthLimit controls how deep the hierarchy is
* navigated to (less than 0 means unlimited)
*/
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, final int depthLimit) {
if (directoryFilter == null && fileFilter == null) {
this.filter = null;
} else {
directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE;
fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE;
directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
this.filter = directoryFilter.or(fileFilter);
}
this.depthLimit = depthLimit;
}
/**
* Internal method that walks the directory hierarchy in a depth-first manner.
*
* Users of this class do not need to call this method. This method will
* be called automatically by another (public) method on the specific subclass.
*
*
* Writers of subclasses should call this method to start the directory walk.
* Once called, this method will emit events as it walks the hierarchy.
* The event methods have the prefix {@code handle}.
*
*
* @param startDirectory the directory to start from, not null
* @param results the collection of result objects, may be updated
* @throws NullPointerException if the start directory is null
* @throws IOException if an I/O Error occurs
*/
protected final void walk(final File startDirectory, final Collection results) throws IOException {
Objects.requireNonNull(startDirectory, "startDirectory");
try {
handleStart(startDirectory, results);
walk(startDirectory, 0, results);
handleEnd(results);
} catch(final CancelException cancel) {
handleCancelled(startDirectory, results, cancel);
}
}
/**
* Main recursive method to examine the directory hierarchy.
*
* @param directory the directory to examine, not null
* @param depth the directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
private void walk(final File directory, final int depth, final Collection results) throws IOException {
checkIfCancelled(directory, depth, results);
if (handleDirectory(directory, depth, results)) {
handleDirectoryStart(directory, depth, results);
final int childDepth = depth + 1;
if (depthLimit < 0 || childDepth <= depthLimit) {
checkIfCancelled(directory, depth, results);
File[] childFiles = filter == null ? directory.listFiles() : directory.listFiles(filter);
childFiles = filterDirectoryContents(directory, depth, childFiles);
if (childFiles == null) {
handleRestricted(directory, childDepth, results);
} else {
for (final File childFile : childFiles) {
if (childFile.isDirectory()) {
walk(childFile, childDepth, results);
} else {
checkIfCancelled(childFile, childDepth, results);
handleFile(childFile, childDepth, results);
checkIfCancelled(childFile, childDepth, results);
}
}
}
}
handleDirectoryEnd(directory, depth, results);
}
checkIfCancelled(directory, depth, results);
}
/**
* Checks whether the walk has been cancelled by calling {@link #handleIsCancelled},
* throwing a {@code CancelException} if it has.
*
* Writers of subclasses should not normally call this method as it is called
* automatically by the walk of the tree. However, sometimes a single method,
* typically {@link #handleFile}, may take a long time to run. In that case,
* you may wish to check for cancellation by calling this method.
*
*
* @param file the current file being processed
* @param depth the current file level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
protected final void checkIfCancelled(final File file, final int depth, final Collection results) throws
IOException {
if (handleIsCancelled(file, depth, results)) {
throw new CancelException(file, depth);
}
}
/**
* Overridable callback method invoked to determine if the entire walk
* operation should be immediately cancelled.
*
* This method should be implemented by those subclasses that want to
* provide a public {@code cancel()} method available from another
* thread. The design pattern for the subclass should be as follows:
*
* If this method returns true, then the directory walk is immediately
* cancelled. The next callback method will be {@link #handleCancelled}.
*
*
* This implementation returns false.
*
*
* @param file the file or directory being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @return true if the walk has been cancelled
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected boolean handleIsCancelled(
final File file, final int depth, final Collection results) throws IOException {
// do nothing - overridable by subclass
return false; // not cancelled
}
/**
* Overridable callback method invoked when the operation is cancelled.
* The file being processed when the cancellation occurred can be
* obtained from the exception.
*
* This implementation just re-throws the {@link CancelException}.
*
*
* @param startDirectory the directory that the walk started from
* @param results the collection of result objects, may be updated
* @param cancel the exception throw to cancel further processing
* containing details at the point of cancellation.
* @throws IOException if an I/O Error occurs
*/
protected void handleCancelled(final File startDirectory, final Collection results,
final CancelException cancel) throws IOException {
// re-throw exception - overridable by subclass
throw cancel;
}
/**
* Overridable callback method invoked at the start of processing.
*
* This implementation does nothing.
*
*
* @param startDirectory the directory to start from
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleStart(final File startDirectory, final Collection results) throws IOException {
// do nothing - overridable by subclass
}
/**
* Overridable callback method invoked to determine if a directory should be processed.
*
* This method returns a boolean to indicate if the directory should be examined or not.
* If you return false, the entire directory and any subdirectories will be skipped.
* Note that this functionality is in addition to the filtering by file filter.
*
*
* This implementation does nothing and returns true.
*
*
* @param directory the current directory being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @return true to process this directory, false to skip this directory
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected boolean handleDirectory(final File directory, final int depth, final Collection results) throws
IOException {
// do nothing - overridable by subclass
return true; // process directory
}
/**
* Overridable callback method invoked at the start of processing each directory.
*
* This implementation does nothing.
*
*
* @param directory the current directory being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleDirectoryStart(final File directory, final int depth, final Collection results) throws
IOException {
// do nothing - overridable by subclass
}
/**
* Overridable callback method invoked with the contents of each directory.
*
* This implementation returns the files unchanged
*
*
* @param directory the current directory being processed
* @param depth the current directory level (starting directory = 0)
* @param files the files (possibly filtered) in the directory, may be {@code null}
* @return the filtered list of files
* @throws IOException if an I/O Error occurs
* @since 2.0
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected File[] filterDirectoryContents(final File directory, final int depth, final File... files) throws
IOException {
return files;
}
/**
* Overridable callback method invoked for each (non-directory) file.
*
* This implementation does nothing.
*
*
* @param file the current file being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleFile(final File file, final int depth, final Collection results) throws IOException {
// do nothing - overridable by subclass
}
/**
* Overridable callback method invoked for each restricted directory.
*
* This implementation does nothing.
*
*
* @param directory the restricted directory
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleRestricted(final File directory, final int depth, final Collection results) throws
IOException {
// do nothing - overridable by subclass
}
/**
* Overridable callback method invoked at the end of processing each directory.
*
* This implementation does nothing.
*
*
* @param directory the directory being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleDirectoryEnd(final File directory, final int depth, final Collection results) throws
IOException {
// do nothing - overridable by subclass
}
/**
* Overridable callback method invoked at the end of processing.
*
* This implementation does nothing.
*
*
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/
@SuppressWarnings("unused") // Possibly thrown from subclasses.
protected void handleEnd(final Collection results) throws IOException {
// do nothing - overridable by subclass
}
/**
* CancelException is thrown in DirectoryWalker to cancel the current
* processing.
*/
public static class CancelException extends IOException {
/** Serialization id. */
private static final long serialVersionUID = 1347339620135041008L;
/** The file being processed when the exception was thrown. */
private final File file;
/** The file depth when the exception was thrown. */
private final int depth;
/**
* Constructs a {@code CancelException} with
* the file and depth when cancellation occurred.
*
* @param file the file when the operation was cancelled, may be null
* @param depth the depth when the operation was cancelled, may be null
*/
public CancelException(final File file, final int depth) {
this("Operation Cancelled", file, depth);
}
/**
* Constructs a {@code CancelException} with
* an appropriate message and the file and depth when
* cancellation occurred.
*
* @param message the detail message
* @param file the file when the operation was cancelled
* @param depth the depth when the operation was cancelled
*/
public CancelException(final String message, final File file, final int depth) {
super(message);
this.file = file;
this.depth = depth;
}
/**
* Returns the file when the operation was cancelled.
*
* @return the file when the operation was cancelled
*/
public File getFile() {
return file;
}
/**
* Returns the depth when the operation was cancelled.
*
* @return the depth when the operation was cancelled
*/
public int getDepth() {
return depth;
}
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/EndianUtils.java 0100644 0000000 0000000 00000041755 13612062727 026631 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import static org.apache.commons.io.IOUtils.EOF;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Utility code for dealing with different endian systems.
*
* Different computer architectures adopt different conventions for
* byte ordering. In so-called "Little Endian" architectures (eg Intel),
* the low-order byte is stored in memory at the lowest address, and
* subsequent bytes at higher addresses. For "Big Endian" architectures
* (eg Motorola), the situation is reversed.
* This class helps you solve this incompatibility.
*
* Origin of code: Excalibur
*
* @see org.apache.commons.io.input.SwappedDataInputStream
*/
public class EndianUtils {
/**
* Instances should NOT be constructed in standard programming.
*/
public EndianUtils() {
}
// ========================================== Swapping routines
/**
* Converts a "short" value between endian systems.
* @param value value to convert
* @return the converted value
*/
public static short swapShort(final short value) {
return (short) ( ( ( ( value >> 0 ) & 0xff ) << 8 ) +
( ( ( value >> 8 ) & 0xff ) << 0 ) );
}
/**
* Converts a "int" value between endian systems.
* @param value value to convert
* @return the converted value
*/
public static int swapInteger(final int value) {
return
( ( ( value >> 0 ) & 0xff ) << 24 ) +
( ( ( value >> 8 ) & 0xff ) << 16 ) +
( ( ( value >> 16 ) & 0xff ) << 8 ) +
( ( ( value >> 24 ) & 0xff ) << 0 );
}
/**
* Converts a "long" value between endian systems.
* @param value value to convert
* @return the converted value
*/
public static long swapLong(final long value) {
return
( ( ( value >> 0 ) & 0xff ) << 56 ) +
( ( ( value >> 8 ) & 0xff ) << 48 ) +
( ( ( value >> 16 ) & 0xff ) << 40 ) +
( ( ( value >> 24 ) & 0xff ) << 32 ) +
( ( ( value >> 32 ) & 0xff ) << 24 ) +
( ( ( value >> 40 ) & 0xff ) << 16 ) +
( ( ( value >> 48 ) & 0xff ) << 8 ) +
( ( ( value >> 56 ) & 0xff ) << 0 );
}
/**
* Converts a "float" value between endian systems.
* @param value value to convert
* @return the converted value
*/
public static float swapFloat(final float value) {
return Float.intBitsToFloat( swapInteger( Float.floatToIntBits( value ) ) );
}
/**
* Converts a "double" value between endian systems.
* @param value value to convert
* @return the converted value
*/
public static double swapDouble(final double value) {
return Double.longBitsToDouble( swapLong( Double.doubleToLongBits( value ) ) );
}
// ========================================== Swapping read/write routines
/**
* Writes a "short" value to a byte array at a given offset. The value is
* converted to the opposed endian system while writing.
* @param data target byte array
* @param offset starting offset in the byte array
* @param value value to write
*/
public static void writeSwappedShort(final byte[] data, final int offset, final short value) {
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
}
/**
* Reads a "short" value from a byte array at a given offset. The value is
* converted to the opposed endian system while reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static short readSwappedShort(final byte[] data, final int offset) {
return (short)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) );
}
/**
* Reads an unsigned short (16-bit) value from a byte array at a given
* offset. The value is converted to the opposed endian system while
* reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static int readSwappedUnsignedShort(final byte[] data, final int offset) {
return ( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) );
}
/**
* Writes a "int" value to a byte array at a given offset. The value is
* converted to the opposed endian system while writing.
* @param data target byte array
* @param offset starting offset in the byte array
* @param value value to write
*/
public static void writeSwappedInteger(final byte[] data, final int offset, final int value) {
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
data[ offset + 2 ] = (byte)( ( value >> 16 ) & 0xff );
data[ offset + 3 ] = (byte)( ( value >> 24 ) & 0xff );
}
/**
* Reads a "int" value from a byte array at a given offset. The value is
* converted to the opposed endian system while reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static int readSwappedInteger(final byte[] data, final int offset) {
return ( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) +
( ( data[ offset + 2 ] & 0xff ) << 16 ) +
( ( data[ offset + 3 ] & 0xff ) << 24 ) );
}
/**
* Reads an unsigned integer (32-bit) value from a byte array at a given
* offset. The value is converted to the opposed endian system while
* reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static long readSwappedUnsignedInteger(final byte[] data, final int offset) {
final long low = ( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) +
( ( data[ offset + 2 ] & 0xff ) << 16 ) );
final long high = data[ offset + 3 ] & 0xff;
return (high << 24) + (0xffffffffL & low);
}
/**
* Writes a "long" value to a byte array at a given offset. The value is
* converted to the opposed endian system while writing.
* @param data target byte array
* @param offset starting offset in the byte array
* @param value value to write
*/
public static void writeSwappedLong(final byte[] data, final int offset, final long value) {
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
data[ offset + 2 ] = (byte)( ( value >> 16 ) & 0xff );
data[ offset + 3 ] = (byte)( ( value >> 24 ) & 0xff );
data[ offset + 4 ] = (byte)( ( value >> 32 ) & 0xff );
data[ offset + 5 ] = (byte)( ( value >> 40 ) & 0xff );
data[ offset + 6 ] = (byte)( ( value >> 48 ) & 0xff );
data[ offset + 7 ] = (byte)( ( value >> 56 ) & 0xff );
}
/**
* Reads a "long" value from a byte array at a given offset. The value is
* converted to the opposed endian system while reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static long readSwappedLong(final byte[] data, final int offset) {
final long low = readSwappedInteger(data, offset);
final long high = readSwappedInteger(data, offset + 4);
return (high << 32) + (0xffffffffL & low);
}
/**
* Writes a "float" value to a byte array at a given offset. The value is
* converted to the opposed endian system while writing.
* @param data target byte array
* @param offset starting offset in the byte array
* @param value value to write
*/
public static void writeSwappedFloat(final byte[] data, final int offset, final float value) {
writeSwappedInteger( data, offset, Float.floatToIntBits( value ) );
}
/**
* Reads a "float" value from a byte array at a given offset. The value is
* converted to the opposed endian system while reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static float readSwappedFloat(final byte[] data, final int offset) {
return Float.intBitsToFloat( readSwappedInteger( data, offset ) );
}
/**
* Writes a "double" value to a byte array at a given offset. The value is
* converted to the opposed endian system while writing.
* @param data target byte array
* @param offset starting offset in the byte array
* @param value value to write
*/
public static void writeSwappedDouble(final byte[] data, final int offset, final double value) {
writeSwappedLong( data, offset, Double.doubleToLongBits( value ) );
}
/**
* Reads a "double" value from a byte array at a given offset. The value is
* converted to the opposed endian system while reading.
* @param data source byte array
* @param offset starting offset in the byte array
* @return the value read
*/
public static double readSwappedDouble(final byte[] data, final int offset) {
return Double.longBitsToDouble( readSwappedLong( data, offset ) );
}
/**
* Writes a "short" value to an OutputStream. The value is
* converted to the opposed endian system while writing.
* @param output target OutputStream
* @param value value to write
* @throws IOException in case of an I/O problem
*/
public static void writeSwappedShort(final OutputStream output, final short value) throws IOException {
output.write((byte) ((value >> 0) & 0xff));
output.write((byte) ((value >> 8) & 0xff));
}
/**
* Reads a "short" value from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static short readSwappedShort(final InputStream input) throws IOException {
return (short) (((read(input) & 0xff) << 0) + ((read(input) & 0xff) << 8));
}
/**
* Reads a unsigned short (16-bit) from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static int readSwappedUnsignedShort(final InputStream input) throws IOException {
final int value1 = read(input);
final int value2 = read(input);
return (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8));
}
/**
* Writes a "int" value to an OutputStream. The value is converted to the opposed endian system while writing.
*
* @param output target OutputStream
* @param value value to write
* @throws IOException in case of an I/O problem
*/
public static void writeSwappedInteger(final OutputStream output, final int value) throws IOException {
output.write((byte) ((value >> 0) & 0xff));
output.write((byte) ((value >> 8) & 0xff));
output.write((byte) ((value >> 16) & 0xff));
output.write((byte) ((value >> 24) & 0xff));
}
/**
* Reads a "int" value from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static int readSwappedInteger(final InputStream input) throws IOException {
final int value1 = read(input);
final int value2 = read(input);
final int value3 = read(input);
final int value4 = read(input);
return ((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16) + ((value4 & 0xff) << 24);
}
/**
* Reads a unsigned integer (32-bit) from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static long readSwappedUnsignedInteger(final InputStream input) throws IOException {
final int value1 = read(input);
final int value2 = read(input);
final int value3 = read(input);
final int value4 = read(input);
final long low = (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16));
final long high = value4 & 0xff;
return (high << 24) + (0xffffffffL & low);
}
/**
* Writes a "long" value to an OutputStream. The value is
* converted to the opposed endian system while writing.
* @param output target OutputStream
* @param value value to write
* @throws IOException in case of an I/O problem
*/
public static void writeSwappedLong(final OutputStream output, final long value) throws IOException {
output.write((byte) ((value >> 0) & 0xff));
output.write((byte) ((value >> 8) & 0xff));
output.write((byte) ((value >> 16) & 0xff));
output.write((byte) ((value >> 24) & 0xff));
output.write((byte) ((value >> 32) & 0xff));
output.write((byte) ((value >> 40) & 0xff));
output.write((byte) ((value >> 48) & 0xff));
output.write((byte) ((value >> 56) & 0xff));
}
/**
* Reads a "long" value from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static long readSwappedLong(final InputStream input) throws IOException {
final byte[] bytes = new byte[8];
for (int i = 0; i < 8; i++) {
bytes[i] = (byte) read(input);
}
return readSwappedLong(bytes, 0);
}
/**
* Writes a "float" value to an OutputStream. The value is
* converted to the opposed endian system while writing.
* @param output target OutputStream
* @param value value to write
* @throws IOException in case of an I/O problem
*/
public static void writeSwappedFloat(final OutputStream output, final float value) throws IOException {
writeSwappedInteger(output, Float.floatToIntBits(value));
}
/**
* Reads a "float" value from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static float readSwappedFloat(final InputStream input) throws IOException {
return Float.intBitsToFloat(readSwappedInteger(input));
}
/**
* Writes a "double" value to an OutputStream. The value is
* converted to the opposed endian system while writing.
* @param output target OutputStream
* @param value value to write
* @throws IOException in case of an I/O problem
*/
public static void writeSwappedDouble(final OutputStream output, final double value) throws IOException {
writeSwappedLong(output, Double.doubleToLongBits(value));
}
/**
* Reads a "double" value from an InputStream. The value is
* converted to the opposed endian system while reading.
* @param input source InputStream
* @return the value just read
* @throws IOException in case of an I/O problem
*/
public static double readSwappedDouble(final InputStream input) throws IOException {
return Double.longBitsToDouble(readSwappedLong(input));
}
/**
* Reads the next byte from the input stream.
* @param input the stream
* @return the byte
* @throws IOException if the end of file is reached
*/
private static int read(final InputStream input) throws IOException {
final int value = input.read();
if (EOF == value) {
throw new EOFException("Unexpected EOF reached");
}
return value;
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/FileCleaner.java 0100644 0000000 0000000 00000015357 13612062727 026562 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.io.File;
/**
* 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. This is done by invoking the method
* {@link #exitWhenFinished}, typically in
* {@code javax.servlet.ServletContextListener.contextDestroyed(javax.servlet.ServletContextEvent)} or similar.
*
* @deprecated Use {@link FileCleaningTracker}
*/
@Deprecated
public class FileCleaner {
/**
* The instance to use for the deprecated, static methods.
*/
static final FileCleaningTracker theInstance = new FileCleaningTracker();
/**
* Track the specified file, using the provided marker, deleting the file
* when the marker instance is garbage collected.
* The {@link FileDeleteStrategy#NORMAL normal} deletion strategy will be used.
*
* @param file the file to be tracked, not null
* @param marker the marker object used to track the file, not null
* @throws NullPointerException if the file is null
* @deprecated Use {@link FileCleaningTracker#track(File, Object)}.
*/
@Deprecated
public static void track(final File file, final Object marker) {
theInstance.track(file, marker);
}
/**
* Track the specified file, using the provided marker, deleting the file
* when the marker instance is garbage collected.
* The specified deletion strategy is used.
*
* @param file the file to be tracked, not null
* @param marker the marker object used to track the file, not null
* @param deleteStrategy the strategy to delete the file, null means normal
* @throws NullPointerException if the file is null
* @deprecated Use {@link FileCleaningTracker#track(File, Object, FileDeleteStrategy)}.
*/
@Deprecated
public static void track(final File file, final Object marker, final FileDeleteStrategy deleteStrategy) {
theInstance.track(file, marker, deleteStrategy);
}
/**
* Track the specified file, using the provided marker, deleting the file
* when the marker instance is garbage collected.
* The {@link FileDeleteStrategy#NORMAL normal} deletion strategy will be used.
*
* @param path the full path to the file to be tracked, not null
* @param marker the marker object used to track the file, not null
* @throws NullPointerException if the path is null
* @deprecated Use {@link FileCleaningTracker#track(String, Object)}.
*/
@Deprecated
public static void track(final String path, final Object marker) {
theInstance.track(path, marker);
}
/**
* Track the specified file, using the provided marker, deleting the file
* when the marker instance is garbage collected.
* The specified deletion strategy is used.
*
* @param path the full path to the file to be tracked, not null
* @param marker the marker object used to track the file, not null
* @param deleteStrategy the strategy to delete the file, null means normal
* @throws NullPointerException if the path is null
* @deprecated Use {@link FileCleaningTracker#track(String, Object, FileDeleteStrategy)}.
*/
@Deprecated
public static void track(final String path, final Object marker, final FileDeleteStrategy deleteStrategy) {
theInstance.track(path, marker, deleteStrategy);
}
/**
* Retrieve the number of files currently being tracked, and therefore
* awaiting deletion.
*
* @return the number of files being tracked
* @deprecated Use {@link FileCleaningTracker#getTrackCount()}.
*/
@Deprecated
public static int getTrackCount() {
return theInstance.getTrackCount();
}
/**
* Call this method to cause the file cleaner thread to terminate when
* there are no more objects being tracked for deletion.
*
* In a simple environment, you don't need this method as the file cleaner
* thread will simply exit when the JVM exits. In a more complex environment,
* with multiple class loaders (such as an application server), you should be
* aware that the file cleaner thread will continue running even if the class
* loader it was started from terminates. This can constitute a memory leak.
*
* For example, suppose that you have developed a web application, which
* contains the commons-io jar file in your WEB-INF/lib directory. In other
* words, the FileCleaner class is loaded through the class loader of your
* web application. If the web application is terminated, but the servlet
* container is still running, then the file cleaner thread will still exist,
* posing a memory leak.
*
* This method allows the thread to be terminated. Simply call this method
* in the resource cleanup code, such as
* {@code javax.servlet.ServletContextListener.contextDestroyed(javax.servlet.ServletContextEvent)}.
* One called, no new objects can be tracked by the file cleaner.
* @deprecated Use {@link FileCleaningTracker#exitWhenFinished()}.
*/
@Deprecated
public static synchronized void exitWhenFinished() {
theInstance.exitWhenFinished();
}
/**
* Returns the singleton instance, which is used by the deprecated, static methods.
* This is mainly useful for code, which wants to support the new
* {@link FileCleaningTracker} class while maintain compatibility with the
* deprecated {@link FileCleaner}.
*
* @return the singleton instance
*/
public static FileCleaningTracker getInstance() {
return theInstance;
}
}
commons-io-2.11.0-src/src/main/java/org/apache/commons/io/FileCleaningTracker.java 0100644 0000000 0000000 00000024750 13612062727 030242 0 ustar 00root root 0000000 0000000 /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io;
import java.io.File;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
/**
* 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. This is done by invoking the method
* {@link #exitWhenFinished}, typically in
* {@code javax.servlet.ServletContextListener.contextDestroyed(javax.servlet.ServletContextEvent)} or similar.
*
*/
public class FileCleaningTracker {
// Note: fields are package protected to allow use by test cases
/**
* Queue of {@code Tracker} instances being watched.
*/
ReferenceQueue