Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 16. Working with Streams > CHARACTER STREAMS

16.3. CHARACTER STREAMS

The text in Java is represented as a set of char values (two-byte characters), which are based on the Unicode Standard. The Java classes FileReader and FileWriter were specifically created to work with text files, but they work only with default character encoding and don't handle localization properly.

The recommended way is to pipe the class InputStreamReader with specified encoding and the FileInputStream. The class InputStreamReader reads bytes and decodes them into characters using a specified CharSet. Each JVM has a default charset, which can be specified during the JVM start-up and depends on the locale. Some of the standard charsets are US-ASCII, UTF-8, and UTF-16.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint