When you need to interact with files, there's the possibility to read all bytes from the file with Files.readAllBytes. But be aware of the kinds of files your application will deal with because the Java API files have a limit for the buffer that is defined as Integer.MAX_VALUE …