xref: /aosp_15_r20/external/apache-commons-io/src/site/xdoc/upgradeto2_5.xml (revision 0c4d7b72e49a04598d65c566f44504b95342d75a)
1*0c4d7b72SSadaf Ebrahimi<?xml version="1.0"?>
2*0c4d7b72SSadaf Ebrahimi<!--
3*0c4d7b72SSadaf EbrahimiLicensed to the Apache Software Foundation (ASF) under one or more
4*0c4d7b72SSadaf Ebrahimicontributor license agreements.  See the NOTICE file distributed with
5*0c4d7b72SSadaf Ebrahimithis work for additional information regarding copyright ownership.
6*0c4d7b72SSadaf EbrahimiThe ASF licenses this file to You under the Apache License, Version 2.0
7*0c4d7b72SSadaf Ebrahimi(the "License"); you may not use this file except in compliance with
8*0c4d7b72SSadaf Ebrahimithe License.  You may obtain a copy of the License at
9*0c4d7b72SSadaf Ebrahimi
10*0c4d7b72SSadaf Ebrahimi     http://www.apache.org/licenses/LICENSE-2.0
11*0c4d7b72SSadaf Ebrahimi
12*0c4d7b72SSadaf EbrahimiUnless required by applicable law or agreed to in writing, software
13*0c4d7b72SSadaf Ebrahimidistributed under the License is distributed on an "AS IS" BASIS,
14*0c4d7b72SSadaf EbrahimiWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15*0c4d7b72SSadaf EbrahimiSee the License for the specific language governing permissions and
16*0c4d7b72SSadaf Ebrahimilimitations under the License.
17*0c4d7b72SSadaf Ebrahimi-->
18*0c4d7b72SSadaf Ebrahimi<document>
19*0c4d7b72SSadaf Ebrahimi    <properties>
20*0c4d7b72SSadaf Ebrahimi        <title>Upgrade from 2.4 to 2.5</title>
21*0c4d7b72SSadaf Ebrahimi        <author email="[email protected]">Commons Documentation Team</author>
22*0c4d7b72SSadaf Ebrahimi    </properties>
23*0c4d7b72SSadaf Ebrahimi    <body>
24*0c4d7b72SSadaf Ebrahimi
25*0c4d7b72SSadaf Ebrahimi        <section name="Upgrade">
26*0c4d7b72SSadaf Ebrahimi            <p>
27*0c4d7b72SSadaf Ebrahimi                These are the release notes and advice for upgrading Commons-IO from
28*0c4d7b72SSadaf Ebrahimi                version 2.4 to version 2.5
29*0c4d7b72SSadaf Ebrahimi                <source>
30*0c4d7b72SSadaf Ebrahimi                    Commons IO is a package of Java utility classes like java.io.
31*0c4d7b72SSadaf Ebrahimi                    Classes in this package are considered to be so standard and of such high
32*0c4d7b72SSadaf Ebrahimi                    reuse as to justify existence in java.io.
33*0c4d7b72SSadaf Ebrahimi
34*0c4d7b72SSadaf Ebrahimi                    The Apache Commons IO library contains utility classes, stream implementations, file filters,
35*0c4d7b72SSadaf Ebrahimi                    file comparators, endian transformation classes, and much more.
36*0c4d7b72SSadaf Ebrahimi
37*0c4d7b72SSadaf Ebrahimi                    ==============================================================================
38*0c4d7b72SSadaf Ebrahimi                    Apache Commons IO Version 2.5
39*0c4d7b72SSadaf Ebrahimi                    ==============================================================================
40*0c4d7b72SSadaf Ebrahimi                    New features and bug fixes.
41*0c4d7b72SSadaf Ebrahimi
42*0c4d7b72SSadaf Ebrahimi                    Changes in this version include:
43*0c4d7b72SSadaf Ebrahimi
44*0c4d7b72SSadaf Ebrahimi                    New features:
45*0c4d7b72SSadaf Ebrahimi                    o IO-487:  Add ValidatingObjectInputStream for controlled deserialization
46*0c4d7b72SSadaf Ebrahimi                    o IO-471:  Support for additional encodings in ReversedLinesFileReader Thanks to Leandro Reis.
47*0c4d7b72SSadaf Ebrahimi                    o IO-425:  Setter method for threshold on ThresholdingOutputStream Thanks to Craig Swank.
48*0c4d7b72SSadaf Ebrahimi                    o IO-406:  Introduce new class AppendableOutputStream Thanks to Niall Pemberton.
49*0c4d7b72SSadaf Ebrahimi                    o IO-459:  Add WindowsLineEndingInputStream and UnixLineEndingInputStream. Thanks to Kristian Rosenvold.
50*0c4d7b72SSadaf Ebrahimi                    o IO-457:  Add a BoundedReader, a wrapper that can be used to constrain access
51*0c4d7b72SSadaf Ebrahimi                            to an underlying stream when used with mark/reset -
52*0c4d7b72SSadaf Ebrahimi                            to avoid overflowing the mark limit of the underlying buffer. Thanks to Kristian Rosenvold.
53*0c4d7b72SSadaf Ebrahimi                    o IO-426:  Add API IOUtils.closeQuietly(Closeable...)
54*0c4d7b72SSadaf Ebrahimi                    o IO-410:  Readfully() That Returns A Byte Array Thanks to Beluga Behr.
55*0c4d7b72SSadaf Ebrahimi                    o IO-395:  Overload IOUtils buffer methods to accept buffer size Thanks to Beluga Behr.
56*0c4d7b72SSadaf Ebrahimi                    o IO-382:  Chunked IO for large arrays.
57*0c4d7b72SSadaf Ebrahimi                             Added writeChunked(byte[], OutputStream) and writeChunked(char[] Writer)
58*0c4d7b72SSadaf Ebrahimi                             Added ChunkedOutputStream, ChunkedWriter
59*0c4d7b72SSadaf Ebrahimi                    o IO-233:  Add Methods for Buffering Streams/Writers To IOUtils
60*0c4d7b72SSadaf Ebrahimi                             Added overloaded buffer() methods - see also IO-330
61*0c4d7b72SSadaf Ebrahimi                    o IO-330:  IOUtils#toBufferedOutputStream/toBufferedWriter to conditionally wrap the output
62*0c4d7b72SSadaf Ebrahimi                             Added overloaded buffer() methods - see also IO-233
63*0c4d7b72SSadaf Ebrahimi                    o IO-381:  Add FileUtils.copyInputStreamToFile API with option to leave the source open.
64*0c4d7b72SSadaf Ebrahimi                            See copyInputStreamToFile(final InputStream source, final File destination, boolean closeSource)
65*0c4d7b72SSadaf Ebrahimi                    o IO-379:  CharSequenceInputStream - add tests for available()
66*0c4d7b72SSadaf Ebrahimi                             Fix code so it really does reflect a minimum available.
67*0c4d7b72SSadaf Ebrahimi                    o IO-346:  Add ByteArrayOutputStream.toInputStream()
68*0c4d7b72SSadaf Ebrahimi                    o IO-341:  A constant for holding the BOM character (U+FEFF)
69*0c4d7b72SSadaf Ebrahimi                    o IO-361:  Add API FileUtils.forceMkdirsParent().
70*0c4d7b72SSadaf Ebrahimi                    o IO-360:  Add API Charsets.requiredCharsets().
71*0c4d7b72SSadaf Ebrahimi                    o IO-359:  Add IOUtils.skip and skipFully(ReadableByteChannel, long). Thanks to yukoba.
72*0c4d7b72SSadaf Ebrahimi                    o IO-358:  Add IOUtils.read and readFully(ReadableByteChannel, ByteBuffer buffer). Thanks to yukoba.
73*0c4d7b72SSadaf Ebrahimi                    o IO-353:  Add API IOUtils.copy(InputStream, OutputStream, int) Thanks to ggregory.
74*0c4d7b72SSadaf Ebrahimi                    o IO-349:  Add API with array offset and length argument to FileUtils.writeByteArrayToFile. Thanks to scop.
75*0c4d7b72SSadaf Ebrahimi                    o IO-348:  Missing information in IllegalArgumentException thrown by org.apache.commons.io.FileUtils#validateListFilesParameters. Thanks to plcstpierre.
76*0c4d7b72SSadaf Ebrahimi                    o IO-345:  Supply a hook method allowing Tailer actively determining stop condition. Thanks to mkresse.
77*0c4d7b72SSadaf Ebrahimi                    o IO-437:  Make IOUtils.EOF public and reuse it in various classes.
78*0c4d7b72SSadaf Ebrahimi
79*0c4d7b72SSadaf Ebrahimi                    Fixed Bugs:
80*0c4d7b72SSadaf Ebrahimi                    o IO-446:  adds an endOfFileReached method to the TailerListener Thanks to Jeffrey Barrus.
81*0c4d7b72SSadaf Ebrahimi                    o IO-484:  FilenameUtils should handle embedded null bytes Thanks to Philippe Arteau.
82*0c4d7b72SSadaf Ebrahimi                    o IO-481:  Changed/Corrected algorithm for waitFor
83*0c4d7b72SSadaf Ebrahimi                    o IO-428:  BOMInputStream.skip returns wrong count if stream contains no BOM Thanks to Stefan Gmeiner.
84*0c4d7b72SSadaf Ebrahimi                    o IO-488:  FileUtils.waitFor(...) swallows thread interrupted status Thanks to Bj�rn Buchner.
85*0c4d7b72SSadaf Ebrahimi                    o IO-452:  Support for symlinks with missing target. Added support for JDK7 symlink features when present Thanks to David Standish.
86*0c4d7b72SSadaf Ebrahimi                    o IO-453:  Regression in FileUtils.readFileToString from 2.0.1 Thanks to Steven Christou.
87*0c4d7b72SSadaf Ebrahimi                    o IO-451:  ant test fails - resources missing from test classpath Thanks to David Standish.
88*0c4d7b72SSadaf Ebrahimi                    o IO-435:  Document that FileUtils.deleteDirectory, directoryContains and cleanDirectory
89*0c4d7b72SSadaf Ebrahimi                             may throw an IllegalArgumentException in case the passed directory does not
90*0c4d7b72SSadaf Ebrahimi                             exist or is not a directory. Thanks to Dominik Stadler.
91*0c4d7b72SSadaf Ebrahimi                    o IO-424:  Javadoc fixes, mostly to appease 1.8.0 Thanks to Ville Skytt�.
92*0c4d7b72SSadaf Ebrahimi                    o IO-389:  FileUtils.sizeOfDirectory can throw IllegalArgumentException Thanks to Austin Doupnik.
93*0c4d7b72SSadaf Ebrahimi                    o IO-390:  FileUtils.sizeOfDirectoryAsBigInteger can overflow.
94*0c4d7b72SSadaf Ebrahimi                             Ensure that recursive calls all use BigInteger
95*0c4d7b72SSadaf Ebrahimi                    o IO-385:  FileUtils.doCopyFile can potentially loop forever
96*0c4d7b72SSadaf Ebrahimi                             Exit loop if no data to copy
97*0c4d7b72SSadaf Ebrahimi                    o IO-383:  FileUtils.doCopyFile caches the file size; needs to be documented
98*0c4d7b72SSadaf Ebrahimi                             Added Javadoc; show file lengths in exception message
99*0c4d7b72SSadaf Ebrahimi                    o IO-380:  FileUtils.copyInputStreamToFile should document it closes the input source Thanks to claudio_ch.
100*0c4d7b72SSadaf Ebrahimi                    o IO-279:  Tailer erroneously considers file as new.
101*0c4d7b72SSadaf Ebrahimi                            Fix to use file.lastModified() rather than System.currentTimeMillis()
102*0c4d7b72SSadaf Ebrahimi                    o IO-356:  CharSequenceInputStream#reset() behaves incorrectly in case when buffer size is not dividable by data size.
103*0c4d7b72SSadaf Ebrahimi                             Fix code so skip relates to the encoded bytes; reset now re-encodes the data up to the point of the mark
104*0c4d7b72SSadaf Ebrahimi                    o IO-368:  ClassLoaderObjectInputStream does not handle primitive typed members
105*0c4d7b72SSadaf Ebrahimi                    o IO-314:  Deprecate all methods that use the default encoding
106*0c4d7b72SSadaf Ebrahimi                    o IO-338:  When a file is rotated, finish reading previous file prior to starting new one
107*0c4d7b72SSadaf Ebrahimi                    o IO-354:  Commons IO Tailer does not respect UTF-8 Charset.
108*0c4d7b72SSadaf Ebrahimi                    o IO-323:  What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
109*0c4d7b72SSadaf Ebrahimi                            Added Javadoc.
110*0c4d7b72SSadaf Ebrahimi                    o IO-372:  FileUtils.moveDirectory can produce misleading error message on failure
111*0c4d7b72SSadaf Ebrahimi                    o IO-362:  IOUtils.contentEquals* methods returns false if input1 == input2, should return true. Thanks to mmadson, ggregory.
112*0c4d7b72SSadaf Ebrahimi                    o IO-357:  [Tailer] InterruptedException while the thread is sleeping is silently ignored Thanks to mortenh.
113*0c4d7b72SSadaf Ebrahimi                    o IO-352:  Spelling fixes. Thanks to scop.
114*0c4d7b72SSadaf Ebrahimi                    o IO-436:  Improper Javadoc comment for FilenameUtils.indexOfExtension. Thanks to christoph.schneegans.
115*0c4d7b72SSadaf Ebrahimi
116*0c4d7b72SSadaf Ebrahimi                    Changes:
117*0c4d7b72SSadaf Ebrahimi                    o IO-433:  Converted all testcases to JUnit 4
118*0c4d7b72SSadaf Ebrahimi                    o IO-466:  Added testcase to show this was fixed with IO-423
119*0c4d7b72SSadaf Ebrahimi                    o IO-479:  Correct exception message in FileUtils.getFile(File, String...) Thanks to Zhouce Chen.
120*0c4d7b72SSadaf Ebrahimi                    o IO-465:  Update to JUnit 4.12 Thanks to based2.
121*0c4d7b72SSadaf Ebrahimi                    o IO-462:  IOExceptionWithCause no longer needed
122*0c4d7b72SSadaf Ebrahimi                    o IO-422:  Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
123*0c4d7b72SSadaf Ebrahimi                    o IO-239:  Convert IOCase to a Java 1.5+ Enumeration
124*0c4d7b72SSadaf Ebrahimi                             [N.B. this is binary compatible]
125*0c4d7b72SSadaf Ebrahimi                    o IO-328:  getPrefixLength returns null if filename has leading slashes
126*0c4d7b72SSadaf Ebrahimi                            Javadoc: add examples to show correct behavior; add unit tests
127*0c4d7b72SSadaf Ebrahimi                    o IO-299:  FileUtils.listFilesAndDirs includes original dir in results even when it doesn't match filter
128*0c4d7b72SSadaf Ebrahimi                            Javadoc: clarify that original dir is included in the results
129*0c4d7b72SSadaf Ebrahimi                    o IO-375:  FilenameUtils.splitOnTokens(String text) check for '**' could be simplified
130*0c4d7b72SSadaf Ebrahimi                    o IO-374:  WildcardFileFilter ctors should not use null to mean IOCase.SENSITIVE when delegating to other ctors
131*0c4d7b72SSadaf Ebrahimi
132*0c4d7b72SSadaf Ebrahimi                    Compatibility with 2.4:
133*0c4d7b72SSadaf Ebrahimi                    Binary compatible: Yes.
134*0c4d7b72SSadaf Ebrahimi                    Source compatible: Yes.
135*0c4d7b72SSadaf Ebrahimi                    Semantic compatible: Yes.
136*0c4d7b72SSadaf Ebrahimi
137*0c4d7b72SSadaf Ebrahimi                    Compatibility with 2.2 and 1.4:
138*0c4d7b72SSadaf Ebrahimi                    Binary compatible: Yes.
139*0c4d7b72SSadaf Ebrahimi                    Source compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
140*0c4d7b72SSadaf Ebrahimi                    Semantic compatible: No, see the rare case in https://issues.apache.org/jira/browse/IO-318.
141*0c4d7b72SSadaf Ebrahimi
142*0c4d7b72SSadaf Ebrahimi                    Commons IO 2.5 requires JDK 1.6 or later.
143*0c4d7b72SSadaf Ebrahimi                    Commons IO 2.4 requires JDK 1.6 or later.
144*0c4d7b72SSadaf Ebrahimi                    Commons IO 2.3 requires JDK 1.6 or later.
145*0c4d7b72SSadaf Ebrahimi                    Commons IO 2.2 requires JDK 1.5 or later.
146*0c4d7b72SSadaf Ebrahimi                    Commons IO 1.4 requires JDK 1.3 or later.
147*0c4d7b72SSadaf Ebrahimi                </source>
148*0c4d7b72SSadaf Ebrahimi            </p>
149*0c4d7b72SSadaf Ebrahimi        </section>
150*0c4d7b72SSadaf Ebrahimi
151*0c4d7b72SSadaf Ebrahimi    </body>
152*0c4d7b72SSadaf Ebrahimi</document>
153