I have a program where the user chooses a filepath that is getting passed as a string.

Now I have a function that should create a BufferedInputStream taking that string and assigning it to a InputStream.

```
try (final InputStream is = IOUtils.toInputStream(pathToFile) ) { ... 

```

My problem here is that I am getting a ByteArrayInputStream instead of a "normal" BufferedInputStream. If I print the variable "is".

Is there a way to guarantee that it has to be a BufferedInputStream or can I cast to a BufferedInputStream?

I also tried this:

```
try (final InputStream is = new ByteArrayInputStream(pathToFile.getBytes(StandardCharsets.UTF_8)) ) {

```

But this didn't work.