Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public static void main(String args[]) {
  2.  
  3. File origen = new File("C:\Users\Montse\Documents\NetBeansProjects\Copiar2\hola.txt");
  4. File destino = new File("C:\Users\Montse\Documents\NetBeansProjects\Copiar2\backupVisibles\hola.txt");
  5.  
  6. try {
  7. InputStream in = new FileInputStream(origen);
  8. OutputStream out = new FileOutputStream(destino);
  9.  
  10. byte[] buf = new byte[1024];
  11. int len;
  12.  
  13. while ((len = in.read(buf)) > 0) {
  14. out.write(buf, 0, len);
  15. }
  16.  
  17. in.close();
  18. out.close();
  19. } catch (IOException ioe){
  20. ioe.printStackTrace();
  21. }
  22.  
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement