-
InterfaceDescriptionuse
java.nio.file.Files.walkFileTree()
and related classes
-
ClassDescriptionWindows ME is long dead. Update to Windows 10 and use
CmdShell
.usejava.nio.file.DirectoryStream
orjava.nio.Files.walkFileTree()
and related classesusejava.nio.file.DirectoryStream
and related classesno longer needed, prefer to useFiles
methods directly.usejava.nio.file.DirectoryStream.Filter<T>
and related classesusejava.nio.file.DirectoryStream.Filter<T>
and related classesusejava.nio.file.Files.walkFileTree()
and related classesusejava.nio.file.FileVisitor
and related classesuse org.apache.commons.io.input.XmlStreamReader insteaduse org.apache.commons.io.input.XmlStreamWriter instead
-
FieldDescriptionuse
java.nio.charset.StandardCharset.ISO_8859_1
usejava.nio.charset.StandardCharset.US_ASCII
usejava.nio.charset.StandardCharset.UTF_16
usejava.nio.charset.StandardCharset.UTF_16BE
usejava.nio.charset.StandardCharset.UTF_16LE
usejava.nio.charset.StandardCharset.UTF_8
usejava.nio.charset.StandardCharset.ISO_8859_1
usejava.nio.charset.StandardCharset.US_ASCII
usejava.nio.charset.StandardCharset.UTF_16
usejava.nio.charset.StandardCharset.UTF_16BE
usejava.nio.charset.StandardCharset.UTF_16LE
usejava.nio.charset.StandardCharset.UTF_8
-
MethodDescriptionuse System#getenv()use System#getenv()As of 3.2.0, removed without replacement.As of 3.2.0, removed without replacement.this method is buggy. Do not depend on it.this method does not work correctly on Windows.use
org.apache.commons.io.FileUtils.cleanDirectory()
useorg.apache.commons.io.FileUtils.copyDirectory()
useorg.apache.commons.io.FileUtils.copyDirectory()
useorg.apache.commons.io.FileUtils.copyDirectory()
usejava.nio.Files.copy(source.toPath(), destination.toPath(), LinkOption.NOFOLLOW_LINKS, StandardCopyOption.REPLACE_EXISTING)
useorg.apache.commons.io.FileUtils.copyFileToDirectory()
usejava.nio.Files.copy(source.openStream(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING)
usejava.nio.Files.createTempFile()
usejava.nio.files.Files.delete(file.toPath())
useorg.apache.commons.io.FileUtils.deleteDirectory()
useorg.apache.commons.io.FileUtils.deleteDirectory()
usejava.nio.files.Files.delete(file.toPath())
usePaths.get(path).getParent().getName()
useorg.apache.commons.io.FilenameUtils.getExtension
usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.APPEND, StandardOpenOption.CREATE)
usejava.nio.files.Files.write(filename, data.getBytes(encoding), StandardOpenOption.APPEND, StandardOpenOption.CREATE)
useFiles.delete(Paths.get(fileName))
usejava.io.File.exists()
usePaths.get(path).getName()
usenew String(java.nio.files.Files.readAllBytes(file.toPath()))
usenew String(java.nio.files.Files.readAllBytes(file.toPath()), encoding)
usenew String(java.nio.files.Files.readAllBytes(file))
usejava.nio.files.Files.readAllLines()
usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)
usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.CREATE)
usejava.nio.files.Files.write(Paths.get(filename), data.getBytes(encoding), StandardOpenOption.CREATE)
usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)
usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)
useorg.apache.commons.io.FileUtils.deleteQuietly()
useorg.apache.commons.io.FileUtils.deleteQuietly()
useorg.apache.commons.io.FilenameUtils.getExtension()
usejava.nio.file.Files.isSymbolicLink(file.toPath())
usejava.nio.file.Files.isSymbolicLink(file.toPath())
assumes the platform default character setusejava.nio.file.Files.createDirectories(Paths.get(dir))
useorg.apache.commons.io.FileNameUtils.normalize()
useorg.apache.commons.io.FilenameUtils.removeExtension()
usejava.nio.Files.move()
useorg.apache.commons.io.FileUtils.sizeOf()
useorg.apache.commons.io.FileUtils.sizeOf()
use try-with-resourcesuse try-with-resourcesuse try-with-resourcesuse try-with-resourcesuse try-with-resourcesuseorg.apache.commons.io.IOUtils.contentEquals()
inline this methodalways specify a character encodingalways specify a character encodinguseorg.apache.commons.io.IOUtils.write()
.useorg.apache.commons.io.IOUtils.write()
.useorg.apache.commons.io.IOUtils.copy()
or in Java 9 and laterInputStream.transferTo()
.useorg.apache.commons.io.IOUtils.copy()
or in Java 9 and laterInputStream.transferTo()
.useorg.apache.commons.io.IOUtils.copy()
.useorg.apache.commons.io.IOUtils.copy()
.useorg.apache.commons.io.IOUtils.copy()
.useorg.apache.commons.io.IOUtils.copy()
.always specify a character encodingalways specify a character encodinguseorg.apache.commons.io.IOUtils.copy()
.always specify a character encodingalways specify a character encodinguseorg.apache.commons.io.IOUtils.write()
.useorg.apache.commons.io.IOUtils.readFully()
.useorg.apache.commons.io.IOUtils.readFully()
.always specify a character encodingalways specify a character encodingalways specify a character encodingalways specify a character encodingalways specify a character encodingalways specify a character encodingusenew String(input, encoding)
usenew String(input, encoding)
always specify a character encodingalways specify a character encodinguseorg.apache.commons.io.IOUtils.toString()
.useorg.apache.commons.io.IOUtils.toString()
.useorg.apache.commons.io.IOUtils.toString()
.useorg.apache.commons.io.IOUtils.toString()
.Rather useMessageBuilder.build()
usePropertyUtils.loadOptionalProperties(java.io.File)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returnsnull
instead of an emptyProperties
instance when the givenFile
isnull
.usePropertyUtils.loadOptionalProperties(java.io.InputStream)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails.usePropertyUtils.loadOptionalProperties(java.net.URL)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returnsnull
instead of an emptyProperties
instance when the givenURL
isnull
.always specify an encoding. Do not depend on the default platform character set.use org.apache.commons.io.input.XmlStreamReader insteaduse org.apache.commons.io.input.XmlStreamReader insteaduseorg.apache.commons.io.input.XmlStreamReader
insteadusejava.lang.Objects.toString()
usejava.lang.Objects.toString()
usejava.lang.Objects.equals()
usejava.lang.String.join(
) insteadusejava.lang.String.join(
) insteadthis method produces platform dependent code and contributes to non-reproducible builds. In the context of Maven, this is almost never what's needed. Remove calls to this method and do not replace them. That is, changeStringutils.unifyLineSeparators(s)
to simplys
.always specify an encoding. Do not depend on the default platform character set.always specify an encoding. Do not depend on the default platform character set.use org.apache.commons.io.input.XmlStreamWriter insteaduse org.apache.commons.io.input.XmlStreamWriter insteadusestr == null || str.trim().isEmpty()
usestr != null && !str.isEmpty()
use the two-arg variantuse {#build(java.io.Reader)}usestr == null || String.isBlank(str)
(Java 11+) ororg.apache.commons.lang3.StringUtils.isBlank(str)
-
ConstructorDescriptionThis is a utility class with only static methods. Don't create instances of it.This is a utility class with only static methods. Don't create instances of it.
java.nio.file.FileVisitor
and related classes