I have a text file having some Hindi characters and my default character encoding in ISO 8859-1. I am using "FileInputStream" to read the data from that file and "FileOutputStream" to write data to another text file.
My code is:
FileInputStream fis = new FileInputStream("D:/input.txt");
int i = -1;
FileOutputStream fos = new FileOutputStream("D:/outputNew.txt");
while((i = fis.read())!= -1){
fos.write(i);
}
fos.flush();
fos.close();
fis.close();
I am not specifying encoding ("UTF-8") anywhere, but still the output file in having proper text.How it is happening , i am not getting?