1<?xml version="1.0"?> 2<!-- 3Licensed to the Apache Software Foundation (ASF) under one or more 4contributor license agreements. See the NOTICE file distributed with 5this work for additional information regarding copyright ownership. 6The ASF licenses this file to You under the Apache License, Version 2.0 7(the "License"); you may not use this file except in compliance with 8the License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12Unless required by applicable law or agreed to in writing, software 13distributed under the License is distributed on an "AS IS" BASIS, 14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15See the License for the specific language governing permissions and 16limitations under the License. 17--> 18<document> 19 <properties> 20 <title>Upgrade from 1.0 to 1.1</title> 21 <author email="[email protected]">Commons Documentation Team</author> 22 </properties> 23<body> 24 25<section name="Upgrade"> 26<p> 27These are the release notes and advice for upgrading Commons-IO from 28version 1.0 to version 1.1. 29<source> 30Commons IO is a package of Java utility classes for java.io's hierarchy. 31Classes in this package are considered to be so standard and of such high 32reuse as to justify existence in java.io. 33 34Commons IO contains utility classes, stream implementations, file filters, 35and endian transformation classes. 36 37 38Incompatible changes from 1.0 39----------------------------- 40Binary compatible - Yes 41 42Source compatible - Yes 43 44Semantic compatible - Yes, except: 45- FileUtils.writeStringToFile() 46 A null encoding previously used 'ISO-8859-1', now it uses the platform default 47 Generally this will make no difference 48 49- LockableFileWriter 50 Improved validation and now create directories if necessary 51 52plus these bug fixes may affect you semantically: 53- FileUtils.touch() (Bug fix 29821) 54 Now creates the file if it did not previously exist 55 56- FileUtils.toFile(URL) (Bug fix 32575) 57 Now handles escape syntax such as %20 58 59- FileUtils.sizeOfDirectory() (Bug fix 36801) 60 May now return a size of 0 if the directory is security restricted 61 62 63Deprecations from 1.0 64--------------------- 65- CopyUtils has been deprecated. 66 Its methods have been moved to IOUtils. 67 The new IOUtils methods handle nulls better, and have clearer names. 68 69- IOUtils.toByteArray(String) - Use {@link String#getBytes()} 70- IOUtils.toString(byte[]) - Use {@link String#String(byte[])} 71- IOUtils.toString(byte[],String) - Use {@link String#String(byte[],String)} 72 73 74Bug fixes from 1.0 75------------------ 76- FileUtils - touch() [29821] 77 Now creates the file if it did not previously exist 78 79- FileUtils - toFile(URL) [32575] 80 Now handles escape syntax such as %20 81 82- FileFilterUtils - makeCVSAware(IOFileFilter) [33023] 83 Fixed bug that caused method to be completely broken 84 85- CountingInputStream [33336] 86 Fixed bug that caused the count to reduce by one at the end of the stream 87 88- CountingInputStream - skip(long) [34311] 89 Bytes from calls to this method were not previously counted 90 91- NullOutputStream [33481] 92 Remove unnecessary synchronization 93 94- AbstractFileFilter - accept(File, String) [30992] 95 Fixed broken implementation 96 97- FileUtils [36801] 98 Previously threw NPE when listing files in a security restricted directory 99 Now throw IOException with a better message 100 101- FileUtils - writeStringToFile() 102 Null encoding now correctly uses the platform default 103 104 105Enhancements from 1.0 106--------------------- 107- FilenameUtils - new class [33303,29351] 108 A static utility class for working with filenames 109 Seeks to ease the pain of developing on Windows and deploying on Unix 110 111- FileSystemUtils - new class [32982,36325] 112 A static utility class for working with file systems 113 Provides one method at present, to get the free space on the filing system 114 115- IOUtils - new public constants 116 Constants for directory and line separators on Windows and Unix 117 118- IOUtils - toByteArray(Reader,encoding) 119 Handles encodings when reading to a byte array 120 121- IOUtils - toCharArray(InputStream) [28979] 122 - toCharArray(InputStream,encoding) 123 - toCharArray(Reader) 124 Reads a stream/reader into a character array 125 126- IOUtils - readLines(InputStream) [36214] 127 - readLines(InputStream,encoding) 128 - readLines(Reader) 129 Reads a stream/reader line by line into a List of Strings 130 131- IOUtils - toInputStream(String) [32958] 132 - toInputStream(String,encoding) 133 Creates an input stream that uses the string as a source of data 134 135- IOUtils - writeLines(Collection,lineEnding,OutputStream) [36214] 136 - writeLines(Collection,lineEnding,OutputStream,encoding) 137 - writeLines(Collection,lineEnding,Writer) 138 Writes a collection to a stream/writer line by line 139 140- IOUtils - write(...) 141 Write data to a stream/writer (moved from CopyUtils with better null handling) 142 143- IOUtils - copy(...) 144 Copy data between streams (moved from CopyUtils with better null handling) 145 146- IOUtils - contentEquals(Reader,Reader) 147 Method to compare the contents of two readers 148 149- FileUtils - toFiles(URL[]) 150 Converts an array of URLs to an array of Files 151 152- FileUtils - copyDirectory() [32944] 153 New methods to copy a directory 154 155- FileUtils - readFileToByteArray(File) 156 Reads an entire file into a byte array 157 158- FileUtils - writeByteArrayToFile(File,byte[]) 159 Writes a byte array to a file 160 161- FileUtils - readLines(File,encoding) [36214] 162 Reads a file line by line into a List of Strings 163 164- FileUtils - writeLines(File,encoding,List) 165 writeLines(File,encoding,List,lineEnding) 166 Writes a collection to a file line by line 167 168- FileUtils - EMPTY_FILE_ARRAY 169 Constant for an empty array of File objects 170 171- ConditionalFileFilter - new interface [30705] 172 Defines the behavior of list based filters 173 174- AndFileFilter, OrFileFilter [30705] 175 Now support a list of filters to and/or 176 177- WildcardFilter [31115] 178 New filter that can match using wildcard file names 179 180- FileFilterUtils - makeSVNAware(IOFileFilter) 181 New method, like makeCVSAware, that ignores Subversion source control directories 182 183- ClassLoaderObjectInputStream 184 An ObjectInputStream that supports a ClassLoader 185 186- CountingInputStream,CountingOutputStream - resetCount() [28976] 187 Adds the ability to reset the count part way through reading/writing the stream 188 189- DeferredFileOutputStream - writeTo(OutputStream) [34173] 190 New method to allow current contents to be written to a stream 191 192- DeferredFileOutputStream [34142] 193 Performance optimizations avoiding double buffering 194 195- LockableFileWriter - encoding support [36825] 196 Add support for character encodings to LockableFileWriter 197 Improve the validation 198 Create directories if necessary 199 200- IOUtils and EndianUtils are no longer final [28978] 201 Allows developers to have subclasses if desired 202</source> 203</p> 204</section> 205 206</body> 207</document> 208