public void readerAndWriter() {
try {
FileInputStream fis = new FileInputStream("h:/a.txt");
FileOutputStream fos = new FileOutputStream("h:/b.txt");
byte[] ss = new byte[1024];
int len = fis.read(ss);
while (len != -1) {
fos.write(ss,0,len);
len = fis.read(ss);
}
fis.close();
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
FileInputStream fis = new FileInputStream("h:/a.txt");
FileOutputStream fos = new FileOutputStream("h:/b.txt");
byte[] ss = new byte[1024];
int len = fis.read(ss);
while (len != -1) {
fos.write(ss,0,len);
len = fis.read(ss);
}
fis.close();
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}