joseleonweb

Untitled

Feb 26th, 2021
618
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package m3uf3path.backup;
  2.  
  3. import java.io.File;
  4. import java.io.FileInputStream;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.io.OutputStream;
  9.  
  10.  
  11. public class CopyFile {
  12.     public static void main(String[] args) {
  13.         InputStream inputStream = null;
  14.         OutputStream outputStream = null;
  15.         try {
  16.             File archivoOriginal = new File("D:\\code\\source\\original.txt");
  17.             File archivoCopia = new File("D:\\code\\destination\\copia.txt");
  18.             inputStream = new FileInputStream(archivoOriginal);
  19.             outputStream = new FileOutputStream(archivoCopia);
  20.             byte[] buffer = new byte[1024];
  21.             int length;
  22.             while ((length = inputStream.read(buffer)) > 0) {
  23.                 outputStream.write(buffer, 0, length);
  24.             }
  25.             inputStream.close();
  26.             outputStream.close();
  27.             System.out.println("Archivo copiado.");
  28.         } catch (IOException e) {
  29.             e.printStackTrace();
  30.         }
  31.     }
  32. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×