public String readFile() throws IOException
{
File rFile = new File("c:/jdk1.5.0_14.rar");
File wFile = new File("e:/jdk1.5.0_16.rar");
try {
FileInputStream iReader = new FileInputStream(rFile);
FileOutputStream oWriter = new FileOutputStream(wFile);
int off = 0;
int length = 1024;
byte[] buff = new byte[length];
// 注意:读出1024字节写入1024字节
while((off=iReader.read(buff,0,length)) !=-1)
{
oWriter.write(buff);
}
oWriter.flush();
oWriter.close();
iReader.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(FileIO.class.getName()).log(Level.SEVERE, null, ex);
}
return "success";
}