Why isn't there File.bufferedInputStream()?

There are extension functions File.inputStream()and File.bufferedReader(...).
When I want to read the file as binary I would like to have File.bufferedInputStream.

It is not a big deal, I can, of course, add such an extension function myself or explicitly create a BufferedInputStream for the InputStream.

I just wonder why it is the way it is.
Besides the inconvenience, it also seems strange that I can get either an input stream or a reader from the file, but only the latter is buffered.

File.bufferedReader() extension is just a shortcut for a common case, which can be achieved with two orthogonal extensions: file.reader().buffered(). You can get a buffered input stream as well with the same approach: file.inputStream().buffered(). We haven’t introduced a shortcut for the latter, because we considered it a less common case than a buffered reader.

2 Likes