public String readFile() lança IOException
{ Arquivo rFile = new Arquivo("c:/jdk1.5.0_14.rar"); Arquivo wArquivo = new Arquivo("e:/jdk1.5.0_16.rar"); tente { FileInputStream iReader = new FileInputStream(rFile); FileOutputStream oWriter = new FileOutputStream(wFile); int desligado = 0; comprimento interno = 1024; byte[] buff = novo byte[comprimento];
// Nota: Leia 1.024 bytes e grave 1.024 bytes
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 "sucesso"; }