Make sure you have a sample non-empty file included in your project to read its contents. You can clone the sample project provided with the book's GitHub repository: https://github.com/PacktPublishing/Kotlin-Standard-Library-Cookbook. In this recipe, we are going to use the file1.txt file located in the src/main/resources directory in the sample project.