# Deprecated API

## Contents

- Deprecated Classes
- Deprecated Exceptions
- Deprecated Fields
- Deprecated Methods
- Deprecated Constructors

- Deprecated Classes
  Class and Description
  org.apache.commons.io.CopyUtils 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).
  org.apache.commons.io.DirectoryWalker Apache Commons IO no longer uses this class. Instead, use `PathUtils.walk(java.nio.file.Path, org.apache.commons.io.file.PathFilter, int, boolean, java.nio.file.FileVisitOption...)` or `Files.walkFileTree(java.nio.file.Path, java.util.Set, int, java.nio.file.FileVisitor)`, and friends.
  org.apache.commons.io.FileCleaner Use `FileCleaningTracker`
  org.apache.commons.io.FileSystemUtils As of 2.6 deprecated without replacement. Use equivalent methods in `FileStore` instead, e.g. `Files.getFileStore(Paths.get("/home")).getUsableSpace()` or iterate over `FileSystems.getDefault().getFileStores()`
  org.apache.commons.io.filefilter.WildcardFilter Use WildcardFileFilter. Deprecated as this class performs directory filtering which it shouldn't do, but that can't be removed due to compatibility.

- Deprecated Exceptions
  Exceptions and Description
  org.apache.commons.io.IOExceptionWithCause (since 2.5) use `IOException` instead

- Deprecated Fields
  Field and Description
  org.apache.commons.io.filefilter.FileFileFilter.FILE Use `FileFileFilter.INSTANCE`.
  org.apache.commons.io.Charsets.ISO_8859_1 Use Java 7's `StandardCharsets`
  org.apache.commons.io.IOUtils.LINE_SEPARATOR Use `System.lineSeparator()`.
  org.apache.commons.io.Charsets.US_ASCII Use Java 7's `StandardCharsets`
  org.apache.commons.io.Charsets.UTF_16 Use Java 7's `StandardCharsets`
  org.apache.commons.io.Charsets.UTF_16BE Use Java 7's `StandardCharsets`
  org.apache.commons.io.Charsets.UTF_16LE Use Java 7's `StandardCharsets`
  org.apache.commons.io.Charsets.UTF_8 Use Java 7's `StandardCharsets`

- Deprecated Methods
  Method and Description
  org.apache.commons.io.filefilter.FileFilterUtils.andFileFilter(IOFileFilter, IOFileFilter) use `FileFilterUtils.and(IOFileFilter...)`
  org.apache.commons.io.LineIterator.closeQuietly(LineIterator) As of 2.6 deprecated without replacement. Please use the try-with-resources statement or handle suppressed exceptions manually.
  org.apache.commons.io.CopyUtils.copy(byte[], Writer) 2.5 use `CopyUtils.copy(byte[], Writer, String)` instead
  org.apache.commons.io.IOUtils.copy(InputStream, Writer) 2.5 use `IOUtils.copy(InputStream, Writer, Charset)` instead
  org.apache.commons.io.CopyUtils.copy(InputStream, Writer) 2.5 use `CopyUtils.copy(InputStream, Writer, String)` instead
  org.apache.commons.io.IOUtils.copy(Reader, OutputStream) 2.5 use `IOUtils.copy(Reader, OutputStream, Charset)` instead
  org.apache.commons.io.CopyUtils.copy(Reader, OutputStream) 2.5 use `CopyUtils.copy(Reader, OutputStream, String)` instead
  org.apache.commons.io.CopyUtils.copy(String, OutputStream) 2.5 use `CopyUtils.copy(String, OutputStream, String)` instead
  org.apache.commons.io.FileCleaner.exitWhenFinished() Use `FileCleaningTracker.exitWhenFinished()`.
  org.apache.commons.io.FileSystemUtils.freeSpace(String) Use freeSpaceKb(String) Deprecated from 1.3, may be removed in 2.0
  org.apache.commons.io.FileSystemUtils.freeSpaceKb() As of 2.6 deprecated without replacement. Please use `FileStore.getUsableSpace()`.
  org.apache.commons.io.FileSystemUtils.freeSpaceKb(long) As of 2.6 deprecated without replacement. Please use `FileStore.getUsableSpace()`.
  org.apache.commons.io.FileSystemUtils.freeSpaceKb(String) As of 2.6 deprecated without replacement. Please use `FileStore.getUsableSpace()`.
  org.apache.commons.io.FileSystemUtils.freeSpaceKb(String, long) As of 2.6 deprecated without replacement. Please use `FileStore.getUsableSpace()`.
  org.apache.commons.io.FileCleaner.getTrackCount() Use `FileCleaningTracker.getTrackCount()`.
  org.apache.commons.io.filefilter.FileFilterUtils.orFileFilter(IOFileFilter, IOFileFilter) use `FileFilterUtils.or(IOFileFilter...)`
  org.apache.commons.io.FileUtils.readFileToString(File) 2.5 use `FileUtils.readFileToString(File, Charset)` instead (and specify the appropriate encoding)
  org.apache.commons.io.FileUtils.readLines(File) 2.5 use `FileUtils.readLines(File, Charset)` instead (and specify the appropriate encoding)
  org.apache.commons.io.IOUtils.readLines(InputStream) 2.5 use `IOUtils.readLines(InputStream, Charset)` instead
  org.apache.commons.io.IOUtils.toByteArray(Reader) 2.5 use `IOUtils.toByteArray(Reader, Charset)` instead
  org.apache.commons.io.IOUtils.toByteArray(String) 2.5 Use `String.getBytes()` instead
  org.apache.commons.io.IOUtils.toCharArray(InputStream) 2.5 use `IOUtils.toCharArray(InputStream, Charset)` instead
  org.apache.commons.io.IOUtils.toInputStream(CharSequence) 2.5 use `IOUtils.toInputStream(CharSequence, Charset)` instead
  org.apache.commons.io.IOUtils.toInputStream(String) 2.5 use `IOUtils.toInputStream(String, Charset)` instead
  org.apache.commons.io.output.AbstractByteArrayOutputStream.toString() 2.5 use `AbstractByteArrayOutputStream.toString(String)` instead
  org.apache.commons.io.IOUtils.toString(byte[]) 2.5 Use `String(byte[])` instead
  org.apache.commons.io.IOUtils.toString(InputStream) 2.5 use `IOUtils.toString(InputStream, Charset)` instead
  org.apache.commons.io.IOUtils.toString(URI) 2.5 use `IOUtils.toString(URI, Charset)` instead
  org.apache.commons.io.IOUtils.toString(URL) 2.5 use `IOUtils.toString(URL, Charset)` instead
  org.apache.commons.io.FileCleaner.track(File, Object) Use `FileCleaningTracker.track(File, Object)`.
  org.apache.commons.io.FileCleaner.track(File, Object, FileDeleteStrategy) Use `FileCleaningTracker.track(File, Object, FileDeleteStrategy)`.
  org.apache.commons.io.FileCleaner.track(String, Object) Use `FileCleaningTracker.track(String, Object)`.
  org.apache.commons.io.FileCleaner.track(String, Object, FileDeleteStrategy) Use `FileCleaningTracker.track(String, Object, FileDeleteStrategy)`.
  org.apache.commons.io.IOUtils.write(byte[], Writer) 2.5 use `IOUtils.write(byte[], Writer, Charset)` instead
  org.apache.commons.io.IOUtils.write(char[], OutputStream) 2.5 use `IOUtils.write(char[], OutputStream, Charset)` instead
  org.apache.commons.io.IOUtils.write(CharSequence, OutputStream) 2.5 use `IOUtils.write(CharSequence, OutputStream, Charset)` instead
  org.apache.commons.io.FileUtils.write(File, CharSequence) 2.5 use `FileUtils.write(File, CharSequence, Charset)` instead (and specify the appropriate encoding)
  org.apache.commons.io.FileUtils.write(File, CharSequence, boolean) 2.5 use `FileUtils.write(File, CharSequence, Charset, boolean)` instead (and specify the appropriate encoding)
  org.apache.commons.io.IOUtils.write(StringBuffer, OutputStream) replaced by write(CharSequence, OutputStream)
  org.apache.commons.io.IOUtils.write(StringBuffer, OutputStream, String) replaced by write(CharSequence, OutputStream, String)
  org.apache.commons.io.IOUtils.write(StringBuffer, Writer) replaced by write(CharSequence, Writer)
  org.apache.commons.io.IOUtils.write(String, OutputStream) 2.5 use `IOUtils.write(String, OutputStream, Charset)` instead
  org.apache.commons.io.IOUtils.writeLines(Collection<?>, String, OutputStream) 2.5 use `IOUtils.writeLines(Collection, String, OutputStream, Charset)` instead
  org.apache.commons.io.FileUtils.writeStringToFile(File, String) 2.5 use `FileUtils.writeStringToFile(File, String, Charset)` instead (and specify the appropriate encoding)
  org.apache.commons.io.FileUtils.writeStringToFile(File, String, boolean) 2.5 use `FileUtils.writeStringToFile(File, String, Charset, boolean)` instead (and specify the appropriate encoding)

- Deprecated Constructors
  Constructor and Description
  org.apache.commons.io.input.CloseShieldInputStream(InputStream) Using this constructor prevents IDEs from warning if the underlying input stream is never closed. Use `CloseShieldInputStream.wrap(InputStream)` instead.
  org.apache.commons.io.output.CloseShieldOutputStream(OutputStream) Using this constructor prevents IDEs from warning if the underlying output stream is never closed. Use `CloseShieldOutputStream.wrap(OutputStream)` instead.
  org.apache.commons.io.input.CloseShieldReader(Reader) Using this constructor prevents IDEs from warning if the underlying reader is never closed. Use `CloseShieldReader.wrap(Reader)` instead.
  org.apache.commons.io.output.CloseShieldWriter(Writer) Using this constructor prevents IDEs from warning if the underlying writer is never closed. Use `CloseShieldWriter.wrap(Writer)` instead.
  org.apache.commons.io.FileUtils() Will be private in 3.0.
  org.apache.commons.io.output.LockableFileWriter(File, boolean, String) 2.5 use `LockableFileWriter(File, Charset, boolean, String)` instead
  org.apache.commons.io.output.NullOutputStream() Use `NullOutputStream.NULL_OUTPUT_STREAM`.
  org.apache.commons.io.input.ReaderInputStream(Reader) 2.5 use `ReaderInputStream(Reader, Charset)` instead
  org.apache.commons.io.input.ReversedLinesFileReader(File) 2.5 use `ReversedLinesFileReader(File, Charset)` instead
  org.apache.commons.io.output.WriterOutputStream(Writer) 2.5 use `WriterOutputStream(Writer, Charset)` instead

Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.