1. Learn
  2. /
  3. Courses
  4. /
  5. Importing Data in Java

Connected

Exercise

Stream chaining

Your company has data files in various text encodings. To standardize processing, your manager has asked you to implement a file reader that explicitly handles UTF-8 encoding. This requires chaining multiple streams together—a key concept in Java I/O.

The BufferedReader, InputStreamReader, FileInputStream, and StandardCharsets classes have been imported for you.

Instructions

100 XP
  • Chain a BufferedReader to an InputStreamReader to a FileInputStream.
  • Read and print the first line from the file.