Deepa,
Sorry for the delayed reply.
Distinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used. When we read/write text into a file, the file io classes use the encoding method either specified in the arg of the IO classes , or the default encoding scheme. For 'streams' /raw bytes encoding is not needed. Maximum we gather the bytes as byte/char/short/int/long/float/double. For this we use the high level streams DataInputStream/DataOutputStrerm which has the readByte/readInt... all primitive reading methods.
But to read a text file which may use any encoding scheme, for Japaneese char may be one scheme/For Chineese chars may be another scheme . So when we write a Japaneese chars/text file using Japaneese encoding scheme, when you write and read from the same machine/computer you need not explicitly specify the 2nd argument '
String encoding' of
new InputStreamReader(InputStream, String enc) . We can omit the 2nd arg.
But what if you transfer the file across to machines using sockets.You just send the text file over the Internet. At the same time you int the InputStreamReader and OutputStreamWriter classes of your appln you explicitly say the 'enc' scheme. Otherwise if you run your application, it is going to use the default encoding scheme of the other machine. This creates confusion especially if you already preparea a text file here and send this textfile over the net and try to read this file using another encoding scheme. It may produce jnk.
So these are the 2 conditions where the encoding scheme is needed snd NOT needed. In other words , if read/write of text file happens in the SAME machine need not specify explicit encoding to the Reader and Write classes. If you read/write in ONE machine and write/read int another it is BETTER to explicitly specify the encoding scheme to InputStreamReader/Writer classes. I think for the 2nd qstn Ajith answered.
regds
maha anna