Skip to content
Advertisement

Tag: apache-commons-io

Does commons-io’s FileUtils.readFileToByteArray close the newly created stream?

I’m creating a program that produce checksums for each files in directory. I’m using FileUtils.readFileToByteArray which internally creates a new FileInputStream. The problem is I didn’t find where the stream is closed and wondering about a possible memory leak. So I’m asking: does this method close the stream after reading it? Answer Short answer: yes, it closes the stream. Slightly

Advertisement