Closed
Description
The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses.
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).
Links:
Metadata
Metadata
Assignees
Labels
No labels