You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).