|
|
@ -0,0 +1,44 @@ |
|
|
|
package dam.com.es; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.FileInputStream; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
|
|
|
|
|
|
public class MyCopy { |
|
|
|
|
|
|
|
public static void main(String [] args) |
|
|
|
throws FileNotFoundException, IOException, InterruptedException{ |
|
|
|
|
|
|
|
|
|
|
|
File copy = new File("FicheroOrigen.txt.txt"); |
|
|
|
|
|
|
|
FileInputStream in = new FileInputStream(copy); |
|
|
|
FileOutputStream out = new FileOutputStream("C:\\Users\\kevin\\MyCopy\\FicheroDestino.txt"); |
|
|
|
|
|
|
|
int n=0; |
|
|
|
|
|
|
|
System.out.println ("\nCopiando ..."); |
|
|
|
System.out.print ("["); |
|
|
|
byte[] completo = in.readAllBytes(); |
|
|
|
for(int i =0; i <completo.length;i++) { |
|
|
|
n = n+completo[i]; |
|
|
|
} |
|
|
|
for(int i =0; i <completo.length;i++) { |
|
|
|
Thread.sleep(200); |
|
|
|
out.write(completo[i]); |
|
|
|
System.out.print("-"); |
|
|
|
} |
|
|
|
System.out.print ("]"); |
|
|
|
in.close(); |
|
|
|
out.close(); |
|
|
|
System.out.print ("\nSe han copiado "+completo.length+" caracteres\n"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |