Need help to read and write using UTF-16LE
Hello,
I am in need of yr help.
In my application i am using UTF-16LE to export and import the data when i am doing immediate.
And sometimes i need to do the import in an scheduled formate..i.e the export and imort will happend in the specified time.
But in my application when i am doing scheduled import, they used the URL class to build the URL for that file and copy the data to one temp file to do the event later.
The importing file is in UTF-16LE formate and i need to write the code for that encoding formate.
The problem is when i am doing scheduled import i need to copy the data of the file into one temp place and they doing the import.
When copying the data from one file to the temp i cant use the UTF-16LE encoding into the URL .And if i get the path from the URl and creating the reader and writer its giving the FileNotFound exception.
Here is the excisting code,
protected void copyFile(String rootURL, String fileName) {
URL url = null;
try {
url = new URL(rootURL);
} catch(java.net.MalformedURLException ex) {
}
if(url != null) {
BufferedWriter out = null;
BufferedReader in = null;
try {
out = new BufferedWriter(new FileWriter(fileName));
in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
do {
line = in.readLine();
if(line != null) {
out.write(line, 0, line.length());
out.newLine();
}
} while(line != null);
in.close();
out.close();
} catch(Exception ex) {
}
}
}
Here String rootURL is the real file name from where i have to get the data and its UTF-16LE formate.And String fileName is the tem filename and it logical one.
I think i tried to describe the problem.
Plz anyone help me.
Thanks in advance.

