Update docs
This commit is contained in:
@ -294,7 +294,7 @@ folder: pmd/rules
|
||||
* [AddEmptyString](pmd_rules_java_performance.html#addemptystring): The conversion of literals to strings by concatenating them with empty strings is inefficient.It ...
|
||||
* [AppendCharacterWithChar](pmd_rules_java_performance.html#appendcharacterwithchar): Avoid concatenating characters as strings in StringBuffer/StringBuilder.append methods.
|
||||
* [AvoidArrayLoops](pmd_rules_java_performance.html#avoidarrayloops): Instead of manually copying data between two arrays, use the efficient System.arraycopy method in...
|
||||
* [AvoidFileStream](pmd_rules_java_performance.html#avoidfilestream): Use Files.newInputStream(Paths.get(fileName)) instead of new FileInputStream(fileName).Use Files....
|
||||
* [AvoidFileStream](pmd_rules_java_performance.html#avoidfilestream): The FileInputStream and FileOutputStream classes contains a finalizer method which will cause gar...
|
||||
* [AvoidInstantiatingObjectsInLoops](pmd_rules_java_performance.html#avoidinstantiatingobjectsinloops): New objects created within loops should be checked to see if they can created outside them and re...
|
||||
* [AvoidUsingShortType](pmd_rules_java_performance.html#avoidusingshorttype): Java uses the 'short' type to reduce memory usage, not to optimize calculation. In fact, the JVM ...
|
||||
* [BigIntegerInstantiation](pmd_rules_java_performance.html#bigintegerinstantiation): Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) andfor Ja...
|
||||
|
@ -117,10 +117,14 @@ public class Test {
|
||||
|
||||
**Minimum Language Version:** Java 1.7
|
||||
|
||||
Use Files.newInputStream(Paths.get(fileName)) instead of new FileInputStream(fileName).
|
||||
Use Files.newOutputStream(Paths.get(fileName)) instead of new FileOutputStream(fileName).
|
||||
Use Files.newBufferedReader(Paths.get(fileName)) instead of new FileReader(fileName).
|
||||
Use Files.newBufferedWriter(Paths.get(fileName)) instead of new FileWriter(fileName).
|
||||
The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses. See [JDK-8080225](https://bugs.openjdk.java.net/browse/JDK-8080225) for details.
|
||||
|
||||
The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, again causing garbage collection issues while finalizer methods are called.
|
||||
|
||||
* Use `Files.newInputStream(Paths.get(fileName))` instead of `new FileInputStream(fileName)`.
|
||||
* Use `Files.newOutputStream(Paths.get(fileName))` instead of `new FileOutputStream(fileName)`.
|
||||
* Use `Files.newBufferedReader(Paths.get(fileName))` instead of `new FileReader(fileName)`.
|
||||
* Use `Files.newBufferedWriter(Paths.get(fileName))` instead of `new FileWriter(fileName)`.
|
||||
|
||||
```
|
||||
//PrimaryPrefix/AllocationExpression/ClassOrInterfaceType[
|
||||
|
Reference in New Issue
Block a user