Home | Blog | Java | Jokes | Poems | Musings | Site Map | Kudos | Downloads | Useful Sites | Interesting | System Setup | Contact

Home Page

AKGBackup - The backup program

            

 

Section 11 : The java.io Package

 


 

Write code that uses objects of the classes InputStreamReader and OutputStreamWriter to translate between Unicode and either platform default or ISO 8859-1 character encoding and Distinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used.

 


 

 

InputStreamReader and OutputStreamWriter

 

 

These classes are bridges between character streams and byte streams. InputStreamReader converts bytes into characters and OutputStreamWriter translates characters written to it into bytes.

 

Constructors:

  • InputStreamReader (InputStream in)

  • InputStreamReader (InputStream in, String encoding)

  • OutputStreamWriter (OutputStream out)

  • OutputStreamWriter (OutputStream out, String encoding)

The constructors, with encoding as parameter, throw UnsupportedEncodingException.

 

Methods of InputStreamReader:

 

  • void close ()

  • String getEncoding ()

  • Int read ()

  • Int read (char [] buffer, int offset, int length)

  • boolean ready ()

 

Methods of OutputStreamWriter:

 

  • void close ()

  • void flush ()

  • String getEncoding ()

  • void write (int c)

  • void write (char [] buffer, int offset, int length)

  • void write (String s, int offset, int length)

 

 

 A character encoding is a scheme for representing characters. Java represents characters internally in the 16 bit Unicode character encoding, but the host platform may use different encoding scheme to represent characters externally. If the default encoding of the host platform is different than that used by Java, then it becomes necessary to translate the characters representation between these two encoding schemes. In such cases, the encoding of the platform may be specified to facilitate this translation.

 


 

section11-1 | section11-2 | section11-3 | section11-4 | section11-5 | section11-6

 

Sections : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

 

 

 

 

 

 

 

 

Home | Blog | Java | Jokes | Poems | Musings | Site Map | Kudos | Downloads | Useful Sites | Interesting | System Setup | Contact  

Loading

 Number of Pages viewed on this site since January' 2003 : Hit Counter eXTReMe Tracker

For any queries, comments or suggestions, write to me .

This site never compromises your privacy, please read this site's privacy policy.