public static void main(String[] args) {
InputStream fis=null;
OutputStream fos=null;
try {
fis = new FileInputStream("D:\\a.txt");
fos = new FileOutputStream("E:\\a.txt");
int n;
while ((n=fis.read())!=-1){
fos.write((char)n);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
if (fis !=null){
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fos !=null){
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}