Skip to content

Remove use of File{Input,Ouput}Stream#2649

Open
rovarga wants to merge 1 commit into
apache:mainfrom
rovarga:no-fis
Open

Remove use of File{Input,Ouput}Stream#2649
rovarga wants to merge 1 commit into
apache:mainfrom
rovarga:no-fis

Conversation

@rovarga
Copy link
Copy Markdown
Contributor

@rovarga rovarga commented May 7, 2026

These two classes have a finalizer in Java 12, hence they are an
unnecessary burden for GC.

Use:

  • Files.newInputStream() instead of FileInputStream
  • Files.newBufferedReader() when we end up converting to a Writer
  • Files.readAllBytes() if we end up reading the stream
  • Files.copy() if we are copying the stream to another stream or file
  • Files.writeString() when we are emitting just a plain string
  • Files.newOutputStream() instead of FileOutputStream
  • Files.newBufferedReader() when we end up conerting to a Writer

Signed-off-by: Robert Varga robert.varga@pantheon.tech

These two classes have a finalizer in Java 12, hence they are an
unnecessary burden for GC.

Use:
- Files.newInputStream() instead of FileInputStream
- Files.newBufferedReader() when we end up converting to a Writer
- Files.readAllBytes() if we end up reading the stream
- Files.copy() if we are copying the stream to another stream or file
- Files.writeString() when we are emitting just a plain string
- Files.newOutputStream() instead of FileOutputStream
- Files.newBufferedReader() when we end up conerting to a Writer

Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant