Apache Commons IO Release Notes When testing on Java 21 and up, enable -XX:+EnableDynamicAgentLoading. When testing on Java 24 and up, don't fail FileUtilsListFilesTest for a different behavior in the JRE. ValidatingObjectInputStream does not validate dynamic proxy interfaces. BoundedInputStream.getRemaining() now reports Long.MAX_VALUE instead of 0 when no limit is set. BoundedInputStream.available() correctly accounts for the maximum read limit. Deprecate IOUtils.readFully(InputStream, int) in favor of toByteArray(InputStream, int). FileUtils#byteCountToDisplaySize() supports Zettabyte, Yottabyte, Ronnabyte and Quettabyte #763. Add org.apache.commons.io.FileUtils.ONE_RB #763. Add org.apache.commons.io.FileUtils.ONE_QB #763. Add org.apache.commons.io.output.ProxyOutputStream.writeRepeat(byte[], int, int, long). Add org.apache.commons.io.output.ProxyOutputStream.writeRepeat(byte[], long). Add org.apache.commons.io.output.ProxyOutputStream.writeRepeat(int, long). Add length unit support in FileSystem limits. Add IOUtils.toByteArray(InputStream, int, int) for safer chunked reading with size validation. Add org.apache.commons.io.file.PathUtils.getPath(String, String). Add org.apache.commons.io.channels.ByteArraySeekableByteChannel. Add IOIterable.asIterable(). Bump org.apache.commons:commons-parent from 85 to 88 #774, #783. [test] Bump commons-codec:commons-codec from 1.18.0 to 1.19.0. [test] Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #769. Inline private constant field ProxyInputStream.exceptionHandler #780. [javadoc] Rename parameter of ProxyOutputStream.write(int) #740. CopyDirectoryVisitor ignores fileFilter #743. org.apache.commons.io.build.AbstractOrigin.getReader(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.AbstractRandomAccessFileOrigin.getReader(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.ByeArrayOrigin.getReader(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.InputStreamOrigin.getReader(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.getWriter(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.AbstractRandomAccessFileOrigin.getWriter(Charset) now maps a null Charset to the default Charset. org.apache.commons.io.build.AbstractOrigin.OutputStreamOrigin.getWriter(Charset) now maps a null Charset to the default Charset. FileUtils.readLines(File, Charset) now maps a null Charset to the default Charset #744. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashCr" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.WindowsLineEndingInputStream, org.apache.commons.io.input.WindowsLineEndingInputStream] At WindowsLineEndingInputStream.java:[line 77]Another occurrence at WindowsLineEndingInputStream.java:[line 81] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashCr" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.WindowsLineEndingInputStream] At WindowsLineEndingInputStream.java:[line 112] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashLf" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.WindowsLineEndingInputStream] At WindowsLineEndingInputStream.java:[line 113] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashLf" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.UnixLineEndingInputStream] At UnixLineEndingInputStream.java:[line 75] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atEos" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.UnixLineEndingInputStream] At UnixLineEndingInputStream.java:[line 120] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashCr" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.UnixLineEndingInputStream] At UnixLineEndingInputStream.java:[line 124] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "atSlashLf" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.UnixLineEndingInputStream] At UnixLineEndingInputStream.java:[line 125] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "closed" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.ProxyInputStream] At ProxyInputStream.java:[line 233] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. Fix SpotBugs [ERROR] Medium: Shared primitive variable "propagateClose" in one thread may not yield the value of the most recent write from another thread [org.apache.commons.io.input.BoundedInputStream] At BoundedInputStream.java:[line 555] AT_STALE_THREAD_WRITE_OF_PRIMITIVE. QueueInputStream reads all but the first byte without waiting. #748. Javadoc fixes and improvements. Avoid NPE in org.apache.commons.io.filefilter.WildcardFilter.accept(File). FileUtils.forceDelete can delete a broken symlink again #756. Fix infinite loop in AbstractByteArrayOutputStream. #758. Add org.apache.commons.io.file.CountingPathVisitor.accept(Path, BasicFileAttributes) #743. Add org.apache.commons.io.Charsets.isAlias(Charset, String). Add org.apache.commons.io.Charsets.isUTF8(Charset). Add org.apache.commons.io.Charsets.toCharsetDefault(String, Charset). Add Tailer ignoreTouch option #757. Bump commons.bytebuddy.version from 1.17.5 to 1.17.6 #754. Bump org.apache.commons:commons-parent from 81 to 85. Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 #761. Deprecate constructor Counters.Counters() to be private in 4.0. Deprecate constructor Charsets.Charsets() to be private in 4.0. Pick up maven-antrun-plugin version from parent POM org.apache:apache. Javadoc is missing its Overview page. Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80). Deprecate DeferredFileOutputStream.getStream() in favor of getOutputStream(). Improve Javadoc for a BoundedInputStream builder() throwing IOException. Improve Javadoc for all implementations of AbstractOriginSupplier#get(). The Consumer to IOUtils.closeQuietly(Closeable, Consumer) now accepts Exception, not just IOException. The Consumer to IOUtils.close(Closeable, IOConsumer) now accepts wrapped Exception, not just IOException. Use Uncheck.getAsBoolean(IOBooleanSupplier) to avoid boxing and unboxing of boolean values. Avoid unnecessary boxing and unboxing of long values in FileUtils.sizeOf(File). Avoid unnecessary boxing and unboxing of int values in UncheckedBufferedReader.read(). Avoid unnecessary boxing and unboxing of int values in UncheckedFilterInputStream.available() and read(). Avoid unnecessary boxing and unboxing of int values in UncheckedFilterReader.read(). FileChannels.contentEquals(FileChannel, FileChannel, int) can return false when comparing a non-blocking channel. Deprecate FileChannels.contentEquals(FileChannel, FileChannel, int) in favor of FileChannels.contentEquals(SeekableByteChannel, SeekableByteChannel, int). Improve performance of IOUtils.contentEquals(InputStream, InputStream) by about 13%. PathUtils.copyFileToDirectory() across file systems #728. IOUtils.contentEquals is incorrect when InputStream.available under-reports. java.lang.ArithmeticException: long overflow java.lang.Math.addExact(Math.java:932) at org.apache.commons.io.file.attribute.FileTimes.ntfsTimeToFileTime(FileTimes.java:164). See also https://issues.apache.org/jira/browse/MDEP-978. java.lang.ArithmeticException: long overflow java.lang.Math.addExact(Math.java:932) at org.apache.commons.io.file.attribute.FileTimes.ntfsTimeToDate(long). FileTimes.toNtfsTime(*) methods can overflow result values. Fix Javadoc for ChunkedOutputStream.Builder. General Javadoc improvements. Calling QueueInputStream.QueueInputStream(null) maps to the same kind of default blocking queue as QueueInputStream.Builder.setBlockingQueue(null). CopyDirectoryVisitor creates incorrect file names when copying between different file systems that use different file system separators ("/" versus "\"); fixes PathUtils.copyDirectory(Path, Path, CopyOption...). ThreadUtils.sleep(Duration) should handle the underlying OS time changing. Add ThrottledInputStream.Builder.setMaxBytes(long, ChronoUnit). Add IOIterable. ReversedLinesFileReader implements IOIterable<String>. Add AbstractByteArrayOutputStream.write(CharSequence, Charset). Add AbstractByteArrayOutputStream.write(byte[]). Add RandomAccessFileOutputStream.getRandomAccessFile(). Add ProxyInputStream.setReference(InputStream), was package-private setIn(InputStream). Add ProxyOutputStream.setReference(OutputStream). Add RandomAccessFileInputStream.copy(long, long, OutputStream). Add ProxyOutputStream.Builder. Add ByteOrderMark.matches(int[]). Add BrokenOutputStream.BrokenOutputStream(Function<String>, Throwable>) and deprecate Supplier<String> constructor. Add IOBooleanSupplier. Add Uncheck.getAsBoolean(IOBooleanSupplier). Add FileChannels.contentEquals(SeekableByteChannel, SeekableByteChannel, int). Add FileChannels.contentEquals(ReadableByteChannel, ReadableByteChannel, int). Add SimplePathVisitor.AbstractBuilder. Add CountingPathVisitor.AbstractBuilder and CountingPathVisitor.Builder. Add AccumulatorPathVisitor.Builder and builder(). Add PathUtils.contentEquals(FileSystem, FileSystem). Bump commons.bytebuddy.version from 1.15.10 to 1.17.5 #710, #715, #720, #734, #735. Bump commons-codec:commons-codec from 1.17.1 to 1.18.0. #717. Bump org.apache.commons:commons-parent from 78 to 81. Clean ups in unit tests. Fix some Javadoc issues. RandomAccessFileMode.toString() is more helpful for debugging when it inherits from Enum. Fix implicit narrowing conversion in compound assignment in UnsynchronizedBufferedReader.skip(long). Missing reserved file names in FileSystem.WINDOWS (superscript digits for COM and LPT). FileUtils.listFiles(final File, String[], boolean) can throw NoSuchFileException #697, #699. FileUtils.forceDelete on non-existent file on Windows throws IOException rather than FileNotFoundException. Use Unicode escapes for superscript characters. #701. Recent incompatible change to FileUtils.listFiles re extensions, see also IO-856. Javadoc: Update details for PathUtils "clean" behavior. Add @FunctionalInterface to ClassNameMatcher. Add ValidatingObjectInputStream.Builder and ValidatingObjectInputStream.builder(). Add a "Safe Deserialization" section to the User Guide for the site. Add IORandomAccessFile. Add RandomAccessFileMode.io(String). Add FileAlterationObserver.Builder() and deprecate most constructors. Add IOUtils.readLines(CharSequence). Add ValidatingObjectInputStream.ObjectStreamClassPredicate to allow configuration reuse. Add RandomAccessFileMode.accept(Path, IOConsumer<RandomAccessFile>). Add RandomAccessFileMode.apply(Path, IOFunction<RandomAccessFile>, T). Add IOIntConsumer. Add ProxyInputStream.AbstractBuilder. Supports setting a consumer for ProxyInputStream.afterRead(int). Add support to AutoCloseInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to BOMInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to BoundedInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to BoundedInputStream for setting a consumer for BoundedInputStream.onMaxLength(long, long). Add support to ChecksumInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to ThrottledInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to ObservableInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to MessageDigestCalculatingInputStream for setting a consumer for ProxyInputStream.afterRead(int). Add support to MessageDigestInputStream for setting a consumer for ProxyInputStream.afterRead(int). Bump org.apache.commons:commons-parent from 74 to 78 #670, #676, #679, #688. Bump commons.bytebuddy.version from 1.15.1 to 1.15.10 #672, #673, #685, #686, #694, #696, #698. Update AbstractStreamBuilder getters from protected to public. Add IOIterator.adapt(Iterable). Add getInputStream() for 'https' and 'http' in URIOrigin #630. Add IOSupplier.getUnchecked(). Add CloseShieldInputStream.systemIn(InputStream). Add NullInputStream.init(). Add AbstractInputStream and refactor duplicate code. Add UnsynchronizedReader. Add UnsynchronizedBufferedReader. FileUtilsWaitForTest does not test anything useful. Add missing unit tests. FileUtils.lastModifiedFileTime(File) calls Objects.requireNonNull() on the wrong object. PathUtils.deleteOnExit(Path) calls Objects.requireNonNull() on the wrong object. Deprecate LineIterator.nextLine() in favor of next(). Fix PMD UnnecessaryFullyQualifiedName. Add test for CircularByteBuffer clear() #620. PathUtils.isPosix(Path, LinkOption...) should return false on null input. AutoCloseInputStream(InputStream) uses ClosedInputStream.INSTANCE when its input is null. Avoid NullPointerException in ProxyInputStream.available() when the underlying input stream is null. Avoid NullPointerException in ProxyInputStream.markSupported() when the underlying input stream is null. Avoid NullPointerException in ProxyInputStream.mark(int) when the underlying input stream is null. BufferedFileChannelInputStream.available() returns 0 before any reads. BufferedFileChannelInputStream.available() should return 0 instead of -1 at the end of the stream. BufferedFileChannelInputStream.available() should return 0 when the stream is closed instead of throwing an exception. CharSequenceInputStream.available() should return 0 after the stream is closed. BoundedInputStream.available() should return 0 when the stream is closed. CircularInputStream.available() should return 0 when the stream is closed. InfiniteCircularInputStream.available() should return 0 when the stream is closed. ChecksumInputStream(InputStream, Checksum, long, long) should fail-fast on null Checksum input. Deprecate NullInputStream.INSTANCE in favor of constructors. NullInputStream.available() should return 0 after the stream is closed. MemoryMappedFileInputStream.available() should return 0 after the stream is closed. RandomAccessFileInputStream.available() should return 0 after the stream is closed. ReaderInputStream.available() should return 0 after the stream is closed. AutoCloseInputStream does not call handleIOException() on close() when the proxied stream throws an IOException. BoundedInputStream does not call handleIOException() on close() when the proxied stream throws an IOException. NullInputStream.read(*) should throw IOException when it is closed. NullInputStream.read(byte[]) should return 0 when the input byte array in length 0. NullInputStream.read(byte[], int, int) should return 0 when the input byte array in length 0 or requested length is 0. MarkShieldInputStream.read(*) should throw IOException when it is closed. Replace deprecated constant FileFileFilter.FILE in Javadoc #657. Pick up exec-maven-plugin version from parent POM. Bump tests commons.bytebuddy.version from 1.14.13 to 1.15.1 #615, #621, #631, #635, #642, #658, #663, #665. Bump tests commons-codec:commons-codec from 1.16.1 to 1.17.1 #644. Bump org.codehaus.mojo:exec-maven-plugin from 3.2.0 to 3.4.1 #632, #652, #659. Bump org.apache.commons:commons-parent from 69 to 74 #628, #637, #649, #661, #664. Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #645, #653, #666. Reimplement FileSystemUtils using NIO. FileSystemUtils no longer throws IllegalStateException. Avoid possible NullPointerException in FileUtils.listAccumulate(File, IOFileFilter, IOFileFilter, FileVisitOption...). BoundedInputStream.reset() not updating count. ThresholdingOutputStream: a negative threshold should behave like a zero threshold and trigger the event on the first write #609. Bump commons.bytebuddy.version from 1.14.12 to 1.14.13 #605. Bump org.apache.commons:commons-parent from 67 to 69 #608. Fix and re-enable testSkip_RequiredCharsets #518. SymbolicLineFileFilter documentation fixes. CharSequenceInputStream.reset() only works once #520. Finish TODO on CharSequenceInputStream #540. Add byte array size validation for methods in EndianUtils #521. Add missing test case CircularByteBufferTest. Make CharSequenceInputStream.available() more correct in the face of multibyte encodings #525. Remove unreachable code in AbstractIOFileFilterTest #526. Rationalize and unify checking for existence of files and directories #529. Avoid NullPointerException in IOCase.checkEquals(String, String) on null input. Avoid NullPointerException in CanExecuteFileFilter.accept(File) on null input. Avoid NullPointerException in CanExecuteFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in CanReadFileFilter.accept(File) on null input. Avoid NullPointerException in CanReadFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in CanWriteFileFilter.accept(File) on null input. Avoid NullPointerException in CanWriteFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in DirectoryFileFilter.accept(File) on null input. Avoid NullPointerException in DirectoryFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in EmptyFileFilter.accept(File) on null input. Avoid NullPointerException in EmptyFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in FileFileFilter.accept(File) on null input. Avoid NullPointerException in FileFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in HiddenFileFilter.accept(File) on null input. Avoid NullPointerException in HiddenFileFilter.accept(Path, BasicFileAttributes) on null input. Avoid NullPointerException in IOCase.checkIndexOf(String, int, String) on null input. Avoid NullPointerException in IOCase.checkRegionMatches(String, int, String) on null input. BoundedInputStream.getCount() should not count EOF. Modernize temporary file creation and deletion in DeferredFileOutputStreamTest #535. Add PathMatcher to IOFileFilter class Javadoc #536. Fix CharSequenceInputStream coding exception handling #537. Deprecate int CountingInputStream#getCount() in favor of long CountingInputStream#getByteCount(). Deprecate CountingInputStream.resetCount() in favor of resetByteCount(). Deprecate CountingInputStream.getMaxLength() in favor of getMaxCount()). NullInputStream breaks InputStream's read method contract. Javadoc shouldn't reference 1.x behavior #539. Don't decode and reencode characters in a potentially different charset in AbstractOrigin.CharSequenceOrigin.getReader(Charset). Let subclasses of CountingInputStream.afterRead(int) throw IOException. Characterization test for broken symlinks when copying directories #547. ClosedInputStream.read(byte[], int, int) does not always return -1. ClosedOutputStream.write(byte[], int, int) does not always throw IOException. XmlStreamReader can't parse an XML document with a multi-line prolog #550. XmlStreamReader can't parse XML an document with an external parsed entity prolog. Update FileNameUtils Javadoc #554. Copy symlinks, not the files the symlinks point to #558. Pickup apache-rat-plugin version from parent POM. Add test for copying a symlink FileUtilsTest#testCopyFile_symLink() #564. Make copyFile copy symbolic links by value rather than reference #565. Deprecate CopyUtils 0-argument constructor. Deprecate EndianUtils 0-argument constructor. Deprecate FileSystemUtils 0-argument constructor. Deprecate FilenameUtils 0-argument constructor. Deprecate RandomAccessFiles 0-argument constructor. Clarify and correct EndianUtils and SwappedDataInputStream API doc #566. Add characterization test for copying a symlinked directory #570. RandomAccessFileInputStream.builder().get() now throws ISE instead of NPE. Test links to targets outside the source directory #571. Focus Javadoc on current version rather than past versions #573, #574. "Self-suppression not permitted" while using BrokenOutput and BrokenInput streams with try-with-resources. Handle zero and negative thresholds #587. Deprecate CountingInputStream in favor of BoundedInputStream. PathUtils.setPosixPermissions(...) only sets permissions if needed. PathUtils.setReadOnly(...) only sets permissions if needed. PathUtils.deleteFile(..., DeleteOption...) only sets permissions if needed. CleaningPathVisitor only sets permissions if needed. DeletingPathVisitor only sets permissions if needed. Add and use PathUtils.getFileName(Path, Function<Path, R>). Add and use PathUtils.getFileNameString(). Make public Erase.rethrow(Throwable). Add BrokenInputStream.BrokenInputStream(Throwable). Add BrokenReader.BrokenReader(Throwable). Add BrokenOutputStream.BrokenOutputStream(Throwable). Add BrokenWriter.BrokenWriter(Throwable). Add BoundedInputStream.getRemaining(). Add FileTimes.toNtfsTime(long). Add FileTimes.fromUnixTime(long). Add FileTimes.isUnixTime(FileTime). Add FileTimes.isUnixTime(long). Add FileTimes.toUnixTime(FileTime). Add BrokenInputStream.Builder. Add PathUtils.getExtension(Path). Add PathUtils.getBaseName(Path). Add ThrottledInputStream. Add IORunnable.noop(). Add ChecksumInputStream and test #548. Add AbstractStreamBuilder.getReader(). Add Maven property project.build.outputTimestamp for build reproducibility. Add ProxyInputStream.unwrap(). Add a running count and builder to BoundedInputStream. Bump commons.bytebuddy.version from 1.14.10 to 1.14.12 #534, #592. Bump org.apache.commons:commons-parent from 65 to 67. Bump commons-codec:commons-codec from 1.16.0 to 1.16.1 #583. Bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 #593. Fix wrong issue id in change log #503. Add test for FileChannels.contentEquals() #509. Fix FileChannels.contentEquals(). Fix some Javadoc issues in LineIterator and IOUtils. Simplify FileAlterationObserver internal processing. Avoid NullPointerException in RegexFileFilter.RegexFileFilter(Pattern). Avoid NullPointerException in RegexFileFilter.accept(Path, BasicFileAttributes). Fix SpotBugs error: Class org.apache.commons.io.filefilter.RegexFileFilter defines non-transient non-serializable instance field pathToString [org.apache.commons.io.filefilter.RegexFileFilter] In RegexFileFilter.java SE_BAD_FIELD. Fix SpotBugs error: Class org.apache.commons.io.filefilter.DelegateFileFilter defines non-transient non-serializable instance field fileFilter [org.apache.commons.io.filefilter.DelegateFileFilter] In DelegateFileFilter.java SE_BAD_FIELD. Fix SpotBugs error: Class org.apache.commons.io.filefilter.DelegateFileFilter defines non-transient non-serializable instance field fileNameFilter [org.apache.commons.io.filefilter.DelegateFileFilter] In DelegateFileFilter.java SE_BAD_FIELD. Fix SpotBugs error: org.apache.commons.io.function.IOStream$1.next() cannot throw NoSuchElementException [org.apache.commons.io.function.IOStream$1] At IOStream.java:[line 98] IT_NO_SUCH_ELEMENT. Fix SpotBugs error: org.apache.commons.io.monitor.FileAlterationMonitor.getObservers() may expose internal representation by returning FileAlterationMonitor.observers [org.apache.commons.io.monitor.FileAlterationMonitor] At FileAlterationMonitor.java:[line 124] EI_EXPOSE_REP. Fix SpotBugs error: Class org.apache.commons.io.monitor.FileAlterationObserver defines non-transient non-serializable instance field fileFilter [org.apache.commons.io.monitor.FileAlterationObserver] In FileAlterationObserver.java SE_BAD_FIELD. Fix SpotBugs error: Class org.apache.commons.io.monitor.FileAlterationObserver defines non-transient non-serializable instance field listeners [org.apache.commons.io.monitor.FileAlterationObserver] In FileAlterationObserver.java SE_BAD_FIELD. Fix SpotBugs error: org.apache.commons.io.FileCleaningTracker.getDeleteFailures() may expose internal representation by returning FileCleaningTracker.deleteFailures [org.apache.commons.io.FileCleaningTracker] At FileCleaningTracker.java:[line 218] EI_EXPOSE_REP. Fix SpotBugs error: org.apache.commons.io.IOExceptionList.getCauseList() may expose internal representation by returning IOExceptionList.causeList [org.apache.commons.io.IOExceptionList] At IOExceptionList.java:[line 118] EI_EXPOSE_REP. Fix SpotBugs error: org.apache.commons.io.IOExceptionList.getCauseList(Class) may expose internal representation by returning IOExceptionList.causeList [org.apache.commons.io.IOExceptionList] At IOExceptionList.java:[line 129] EI_EXPOSE_REP. Fix SpotBugs error: org.apache.commons.io.file.AccumulatorPathVisitor.getDirList() may expose internal representation by returning AccumulatorPathVisitor.dirList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 179] EI_EXPOSE_REP. Fix SpotBugs error: org.apache.commons.io.file.AccumulatorPathVisitor.getFileList() may expose internal representation by returning AccumulatorPathVisitor.fileList [org.apache.commons.io.file.AccumulatorPathVisitor] At AccumulatorPathVisitor.java:[line 188] EI_EXPOSE_REP. Fix SpotBugs error: org.apache.commons.io.input.ObservableInputStream.getObservers() may expose internal representation by returning ObservableInputStream.observers [org.apache.commons.io.input.ObservableInputStream] At ObservableInputStream.java:[line 187] EI_EXPOSE_REP. Fix SpotBugs error: Exception thrown in class org.apache.commons.io.input.UnsynchronizedByteArrayInputStream at new org.apache.commons.io.input.UnsynchronizedByteArrayInputStream(byte[], int) will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. [org.apache.commons.io.input.UnsynchronizedByteArrayInputStream, org.apache.commons.io.input.UnsynchronizedByteArrayInputStream] At UnsynchronizedByteArrayInputStream.java:[line 202]At UnsynchronizedByteArrayInputStream.java:[line 202] CT_CONSTRUCTOR_THROW. Fix SpotBugs error: Exception thrown in class org.apache.commons.io.input.UnsynchronizedByteArrayInputStream at new org.apache.commons.io.input.UnsynchronizedByteArrayInputStream(byte[], int, int) will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. [org.apache.commons.io.input.UnsynchronizedByteArrayInputStream, org.apache.commons.io.input.UnsynchronizedByteArrayInputStream] At UnsynchronizedByteArrayInputStream.java:[line 223]At UnsynchronizedByteArrayInputStream.java:[line 223] CT_CONSTRUCTOR_THROW. Bump org.codehaus.mojo:exec-maven-plugin from 3.1.0 to 3.1.1 #512. Bump commons-lang3 from 3.13.0 to 3.14.0. Bump commons.bytebuddy.version from 1.14.9 to 1.14.10 #516. Bump commons-parent from 64 to 65. XmlStreamReader encoding match RE is too strict. Javadoc in FileUtils does not reflect code for thrown exceptions. Javadoc should mention closing Streams based on file resources. In tests, Files.walk() direct and indirect callers fail to close the returned Stream. FileUtils.listFiles(File, String[], boolean) fails to close its internal Stream. FileUtils.iterateFiles(File, String[], boolean) fails to close its internal Stream. StreamIterator fails to close its internal Stream. Don't throw UncheckedIOException #491. Don't write a BOM on every (or any) line #492. RandomAccessFileMode.create(Path) provides a better NullPointerException message. Improve performance of PathUtils.fileContentEquals(Path, Path, LinkOption[], OpenOption[]) by about 60%, see PathUtilsContentEqualsBenchmark. Improve performance of PathUtils.fileContentEquals(Path, Path) by about 60%, see PathUtilsContentEqualsBenchmark. Improve performance of FileUtils.contentEquals(File, File) by about 60%, see PathUtilsContentEqualsBenchmark. Remove unused test code #494. [Javadoc] IOUtils#contentEquals does not throw NullPointerException #496. Fix CodeQL warnings in UnsynchronizedBufferedInputStream: Implicit narrowing conversion in compound assignment. MessageDigestCalculatingInputStream.MessageDigestMaintainingObserver.MessageDigestMaintainingObserver(MessageDigest) now throws a NullPointerException if the MessageDigest is null. MessageDigestCalculatingInputStream.MessageDigestCalculatingInputStream(InputStream, MessageDigest) now throws a NullPointerException if the MessageDigest is null. UnsynchronizedBufferedInputStream.read(byte[], int, int) does not use buffer. Pick up Maven Moditect plugin version from parent POM. 2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system. Add org.apache.commons.io.channels.FileChannels. Add RandomAccessFiles#contentEquals(RandomAccessFile, RandomAccessFile). Add RandomAccessFiles#reset(RandomAccessFile). Add PathUtilsContentEqualsBenchmark. Add org.apache.commons.io.StreamIterator. Add MessageDigestInputStream and deprecate MessageDigestCalculatingInputStream. Bump org.apache.commons:commons-parent from 62 to 64. ReaderInputStream.read() throws an exception instead of returning -1 when called again after returning -1. FileUtils.forceMkdirParent() Javadoc is incorrect. [StepSecurity] ci: Harden GitHub Actions #461. MagicNumberFileFilter.accept(Path, BasicFileAttributes) doesn't set its byteOffset before reading. Javadoc improvements. Spelling #468. Use assertThrows #475. Add DeferredFileOutputStream.getPath(). Add FileCleaningTracker.track(Path, Object[, FileDeleteStrategy]). Add IOUtils.skip[Fully](InputStream, long, Supplier<byte[]>). Add FilesUncheck.find(Path, int, BiPredicate%lt;Path, BasicFileAttributes>, FileVisitOption...) Add IOIntSupplier. Add IOLongSupplier. Add Uncheck.getAsInt(IOIntSupplier [, Supplier<String>]). Add Uncheck.getAsLong(IOLongSupplier [, Supplier<String>]). Add Uncheck.run(IORunnable, Supplier<String>) Add Uncheck.get(IOSupplier, Supplier<String>) IOFileFilter now also extends java.nio.file.PathMatcher. Add PathMatcherFileFilter to adapt java.nio.file.PathMatcher. Add ThresholdingOutputStream.getOutputStream() and deprecate getStream(). Add DeferredFileOutputStream.Builder.setOutputFile(Path). Add DeferredFileOutputStream.Builder.setDirectory(Path). Add AbstractStreamBuilder.setBufferSizeChecker(IntToIntFunction). Add AbstractStreamBuilder.setBufferSizeMax(int). Bump jimfs from 1.2 to 1.3.0 #465 (tests). Bump commons-parent from 58 to 62. Bump commons-lang3 from 3.12 to 3.13.0. Regression in FileUtils.touch() - no longer creates parent directories. ByteArrayOrigin should be able convert a byte[] to a ByteArrayInputStream. AbstractOriginSupplier.checkOrigin() now throws IllegalStateException instead of NullPointerException. FileAlreadyExistsException in PathUtils.createParentDirectories(Path, LinkOption, FileAttribute...). Only read the relevant portion of a file in AbstractOrigin.FileOrigin.getByteArray(long, int). Only read the relevant portion of a file in AbstractOrigin.PathOrigin.getByteArray(long, int). DeferredFileOutputStream throws exception when system temp dir is a symlink. ReaderInputStream.Builder.setCharsetEncoder(null) should reset to a default object, not throw an NPE. ReaderInputStream.Builder.setCharset(null) should reset to a default object, not throw an NPE. Fix back-incompatible change for PathUtils.deleteDirectory(): throw NoSuchFileException instead of IllegalArgumentException #459. Deprecation documentation gives incorrect alternative. Add CharSequenceInputStream.Builder. Add ChunkedOutputStream.Builder. Add AbstractStreamBuilder.setOpenOptions(OpenOption...). Add some missing conversions to AbstractOrigin subclasses. Add AbstractOrigin.getByteArray(long, int). Add and use RandomAccessFiles. Add AbstractOrigin.size(). Add PathUtils.EMPTY_FILE_ATTRIBUTE_ARRAY. Add CharSequenceInputStream.Builder.setCharsetEncoder(CharsetEncoder). Add CharsetEncoders.toCharsetEncoder(CharsetEncoder, Supplier<CharsetEncoder>). Bump commons-parent from 57 to 58. IOUtils.toByteArray size validation does not match documentation. Fix Javadoc links to the JRE Javadoc 8. FileWriterWithEncoding for an existing file no longer truncates the file. #251. A null Charset or Charset name in FileWriterWithEncoding constructors uses the default Charset. Fix usage of assertNotNull #269. FilenameUtils directoryContains() should handle files with the same prefix #217. Drop unnecessary casts and conversions #267. FileUtils.moveToDirectory() exception documentation and exception message error. ThreadMonitor.sleep(Duration) ignores nanoseconds. Fix Javadoc in ThreadMonitor#run() method. #273. FileUtils.listFiles() does not list matching files if File parameter is a symbolic link. Fix typo in Javadocs for FileUtils#convertFileCollectionToFileArray() #276. Avoid Code Duplication: Reuse Sleep from ThreadMonitor #66. FileUtils.iterateFiles also lists directories. Wrong exception message in FileUtils.setLastModified(File, File). Infinite loop in ReaderInputStream instead of throwing exception for CodingErrorAction.REPORT. ReaderInputStream enter infinite loop for too small buffer sizes. Infinite loop in CharSequenceInputStream.read for 4-byte characters with UTF-8 and 3-byte buffer. PathUtils.setReadOnly(Path, boolean, LinkOption...) should add READ_* file attributes when using POSIX. PathUtils.setReadOnly(Path, boolean, LinkOption...) readOnly argument is always assumed true on POSIX. Prevent IllegalArgumentExceptions in BrokenInputStream/Reader/OutputStream/Writer #278. FileUtils.copyURLToFile(URL, File, int, int) leaks its URLConnection. Called by FileUtils.copyURLToFile(URL, File). Fixed ReaderInputStream not calling CharsetEncoder.flush issue #283. Minor changes #287. Update FileWriterWithEncoding to extend ProxyWriter #296. Initialize the message of an IOExceptionList to a default if null. When deleting symlinks, File/PathUtils.deleteDirectory() changes file permissions of the target. ReaderInputStream maps null Charset, Charset name, and CharsetEncoder to the platform default instead of throwing a NullPointerException. CharSequenceInputStream maps null Charset and Charset name to the platform default instead of throwing a NullPointerException. WriterOutputStream maps null Charset, Charset name, and CharsetEncoder name to the platform default instead of throwing a NullPointerException. FileUtils.copyURLToFile should create target parent directories and overwrite target file #319. Fix incorrect FilenameUtils Javadoc for null bytes #310. Change to uppercase variable constant. #323. IOCase.isCaseSensitive(IOCase) result is backward #325. Deprecate PathUtils.NOFOLLOW_LINK_OPTION_ARRAY in favor of noFollowLinkOptionArray(). Improve ReaderInputStream documentation #291. Fix misleading comments in FileFilterTest #334. Add missing Javadoc for exceptions thrown for invalid arguments #339. FileFilterTest minor fixes #340. IOUtils.write() throws OutOfMemoryError/NegativeArraySizeException while writing big strings #343. Add reserved Windows file names CONIN$ and CONOUT$ to FileSystem #355. RegexFileFilter is no longer Serializable. [Javadoc] FileFilterUtils doc does not match impl: missing some file filters. FileSystem.WINDOWS.isReservedFileName doesn't check for file extension. Confusing Javadoc on IOUtils#resourceToURL() and other resource* methods. FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents from" exception. Pick up Javadoc from super for override write() methods in AbstractByteArrayOutputStream and ByteArrayOutputStream. Fix minor typos #367. Fix parameters to requireNonNull call in DeferredOutputSteam #368. Fix PathUtils.copyFileToDirectory(URL,Path,CopyOption[]). FileUtils.doCopyFile uses different methods to check the file sizes. Fix typos #375. FilenameUtils.normalize javadoc and tests #383. Better docs in IOUtils and IOUtils.byteArray(int size) #374. SequenceReader should close readers when its close method is called #391. Fix symbolic link file filter #450. Apply nanoseconds precision for QueueInputStream timeout duration. #453. Fix overflow for FileUtilsTest constants #456. Serialization is deprecated and will be removed in 3.0. FileSystemUtils.performCommand(String[], int, Duration): Use Locale.getDefault() instead of ENGLISH. Add GitHub coverage.yml. Add MemoryMappedFileInputStream #215. Add BrokenReader.INSTANCE. Add UncheckedBufferedReader. Add UncheckedFilterReader. Add UncheckedFilterWriter. Add UncheckedFilterInputStream. Add UncheckedFilterOutputStream. Add BrokenInputStream.INSTANCE. Add ClosedInputStream.INSTANCE and deprecate CLOSED_INPUT_STREAM. Add ClosedReader.INSTANCE and deprecate CLOSED_READER. Add BrokenWriter.INSTANCE. Add ClosedOutputStream.INSTANCE and deprecate CLOSED_OUTPUT_STREAM. Add ClosedWriter.INSTANCE and deprecate CLOSED_WRITER. Add NullOutputStream.INSTANCE and deprecate NULL_OUTPUT_STREAM. Add NullPrintStream.INSTANCE and deprecate NULL_PRINT_STREAM. Add NullWriter.INSTANCE and deprecate NULL_WRITER. Add NullInputStream.INSTANCE. Add NullReader.INSTANCE. Add PathUtils.readString(Path, Charset). Add FileUtils.newOutputStream(File, boolean). Add PathUtils.newOutputStream(Path, boolean). Add UncheckedAppendable. Add and reuse UncheckedIOExceptions. Add PathUtils.getTempDirectory(). Add FileSystem.getNameSeparator(). Add FileSystem.normalizeSeparators(). Add PathUtils.isNewer(Path, FileTime, LinkOption...). Add PathUtils.isNewer(Path, Instant, LinkOption...). Add AgeFileFilter.AgeFileFilter(Instant). Add AgeFileFilter.AgeFileFilter(Instant, boolean). Add FileUtils.lastModifiedFileTime(File). Add FileTimes. Add PathUtils.waitFor(Path, Duration, LinkOption...). Add org.apache.commons.io.input.Tailer.getDelayDuration(). Add FileUtils.current(). Add and use PathUtils.setLastModifiedTime(Path) for more precision. Add and use PathUtils.setLastModifiedTime(Path, Path) for more precision. Add and use PathUtils.isNewer(Path, ChronoZonedDateTime, LinkOption...) for more precision. Add and use PathUtils.isNewer(Path, Path) for more precision. Add and use FileUtils.isNewer(File, FileTime) for more precision. Add and use PathUtils.isOlder(Path, FileTime, LinkOption...). Add and use PathUtils.isOlder(Path, Instant, LinkOption...). Add and use PathUtils.isOlder(Path, long, LinkOption...). Add and use PathUtils.isOlder(Path, Path). Add and use PathUtils.sizeOf(Path). Add and use PathUtils.sizeOfAsBigInteger(Path). Add and use PathUtils.sizeOfDirectory(Path). Add and use PathUtils.sizeOfDirectoryAsBigInteger(Path). Add and use IOCase.value(IOCase, IOCase). Add Tailer.Tailable interface to allow tailing of remote files for example using jCIFS. Add and use RandomAccessFileMode. Add PathUtils.writeString(Path, CharSequence, Charset, OpenOption...). Add PathUtiFiles.getFileAttributeView() shorthands: - PathUtils.getAclFileAttributeView(Path, LinkOption...) - PathUtils.getDosFileAttributeView(Path, LinkOption...) - PathUtils.getPosixFileAttributeView(Path, LinkOption...) Make commons-io a JPMS module by adding module-info.class. Add IOUtils method to copy output stream to input stream #281. Add PathUtils.isPosix(Path, LinkOption...). #290 Add PathUtils.readAttributes(Path, Class, LinkOption...). #290 Add IOExceptionList.checkEmpty(List, Object). Add IOBiConsumer, IOTriConsumer, IOComparator, IOUnaryOperator, IOBinaryOperator. Add and reuse IOConsumer forAll(*), forEach(*), and forEachIndexed(*). Add CharsetEncoders. Add CharsetDecoders. Add PathUtils.createParentDirectories(Path, LinkOption, FileAttribute...). Update FileEntry to use FileTime instead of long for file time stamps. Add more tests for IOUtils.contentEqualsIgnoreEOL #137. Reduce boilerplate through new UncheckedIO class and friends in org.apache.commons.io.function. Add PathUtils.touch(Path). Add FileSystem.getIllegalFileNameCodePoints(). Add FileUtils.isFileNewer(File, ChronoLocalDate, OffsetTime). Add FileUtils.isFileNewer(File, OffsetDateTime). Add FileUtils.isFileOlder(File, ChronoLocalDate, OffsetTime). Add FileUtils.isFileOlder(File, OffsetDateTime). Add IOBiConsumer.noop(). Add IOUtils.closeQuietly(Iterable<Closeable>). Add IOUtils.closeQuietly(Stream<Closeable>). Add Charsets.toCharset(Charset, Charset). Add Charsets.toCharset(String, Charset). Add XmlStreamWriter(OutputStream, Charset). Add PathUtils.getLastModifiedFileTime(*). Add IOBiFunction, IOTriFunction, IOQuadFunction, IOPredicate, IOIterator, IOSpliterator, IOBaseStream, IOStream, FilesUncheck. Add IOUtils.consume(Reader). Add IOSupplier.asSupplier(). Add IOFunction.asFunction(). Add IOConsumer.asConsumer(). Add TimestampedObserver.isClosed(). IOExceptionList implements Iterable. Add support for Appendable to HexDump #418. Add and use ThreadUtils. Add UnsynchronizedFilterInputStream. Add UnsynchronizedBufferedInputStream. Add FileSystem.getBlockSize(). Add builders and avoid creating more constructors for all permutations of current options. Refactor using new Supplier API IOUtils.toString(IOSupplier<InputStream>, Charset[, IOSupplier<String>]). Refactor using new Supplier API org.apache.commons.io.file.PathUtils.copy(IOSupplier<InputStream>, Path, CopyOption...). Bump actions/cache from 2.1.6 to 3.0.10 #307, #337, #393. Bump actions/checkout from 2.3.4 to 3.1.0 #286, #298, #330, #392. Bump actions/setup-java from 2 to 3.6.0 #346, #397. Bump github/codeql-action from 1 to 2 #353. Bump Maven Javadoc plugin from 3.2.0 to 3.4.1. Bump spotbugs-maven-plugin from 4.2.3 to 4.7.3.0 #250, #259, #272, #274, #285, #288, #289, #305, #315, #326, #338, #360, #366, #370, #380, #395, #403. Bump spotbugs from 4.5.2 to 4.7.3 #313, #317, #357, #382, #398. Bump JUnit from 5.7.2 to 5.8.2. Bump maven-enforcer-plugin from 3.0.0-M3 to 3.3.0 #255, #363, #431, #446. Bump checkstyle from 8.44 to 9.3 #256, #257, #266, #279, #292. #308. Bump junit-bom from 5.8.0-M1 to 5.9.1 #260, #271, #275, #309, #386. Bump mockito-inline from 3.11.2 to 4.11.0 #262, #264, #282, #306, #314, #331, #348, #359, #381, #399, #405, #414, #420. Bump jmh.version from 1.32 to 1.36 #258, #316, #342, #404. Bump moditect-maven-plugin from 1.0.0.RC1 to 1.0.0.Final #280, #439, #445. Bump junit-pioneer from 1.4.2 to 1.9.1 #304. #335, #362, #402, #406, #409. Bump japicmp-maven-plugin from 0.15.3 to 0.16.0. Bump commons-parent from 52 to 57 #388, #415, #421, #184. Bump jacoco-maven-plugin from 0.8.7 to 0.8.8. Bump maven-antrun-plugin from 3.0.0 to 3.1.0 #354. Bump commons.surefire.version 3.0.0-M5 to 3.0.0-M7. Bump PMD from 6.44.0 to 6.52.0. Bump maven-pmd-plugin from 3.16.0 to 3.19.0. Bump apache-rat from 0.13 to 0.14. Bump exec-maven-plugin from 3.0.0 to 3.1.0 #369. Bump maven-checkstyle-plugin from 3.1.2 to 3.2.0 #376. Bump apache-rat-plugin from 0.14 to 0.15 #387. Bump default buffer size for CharSequenceInputStream to IOUtils#DEFAULT_BUFFER_SIZE. Bump default buffer size for ChunkedOutputStream to IOUtils#DEFAULT_BUFFER_SIZE. Bump default buffer size for ChunkedWriter to IOUtils#DEFAULT_BUFFER_SIZE. Bump default buffer size for ReaderInputStream to IOUtils#DEFAULT_BUFFER_SIZE. Bump default buffer size for WriterOutputStream to IOUtils#DEFAULT_BUFFER_SIZE. 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. 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.5.0, #158, #164, #165, #180, #199, #213, #224, #302. 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.6.0 #134, #332. 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.Observer 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 forever 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 [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 failure 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.