Reading UTF - 8 Encoded Data in Java

In this section, you will learn what is UTF - 8 Encoded Data and how does that perform the work.

Reading UTF - 8 Encoded Data in Java


C:\nisha>java ReadUTF8
Enter File name : Filterfile.txt
File text : ??t h i s i s a f i l e
Reading Process Completly Successfully.


The above code written in the program creates a instance of the BufferedReader class using the InputStreamReader and FileInputStream classes to read data or contents from the specified file in the specified encoded data format that has been mentioned in above given line of the code(UTF8). This is thrown by the UnsupportedEncodingException exception if the given encoded data format does not support.

Download this example.