|
|
@ -1,76 +1,64 @@ |
|
|
|
package jorpelu.com; |
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
import java.io.File; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
|
|
|
public class MyCopy { |
|
|
|
public class MyCopy { |
|
|
|
Ventana ventana; |
|
|
|
|
|
|
|
public MyCopy(String RutaIn, JFrame jf, String RutaOut){ |
|
|
|
|
|
|
|
if(RutaOut==null) { |
|
|
|
RutaOut = "."; |
|
|
|
} |
|
|
|
File fich = new File(RutaOut); |
|
|
|
File fich_a_copiar = new File(RutaIn); |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws FileNotFoundException, IOException { |
|
|
|
File fich = new File(".\\Salida.dat"); |
|
|
|
File fich_a_copiar = new File("textp.dat"); |
|
|
|
if(fich_a_copiar.exists() == false) { |
|
|
|
try { |
|
|
|
fich_a_copiar.createNewFile(); |
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
fich_a_copiar.createNewFile(); |
|
|
|
} |
|
|
|
String[] calculando = {"-", "\\", "|", "/"}; |
|
|
|
|
|
|
|
FileInputStream in; |
|
|
|
try { |
|
|
|
in = new FileInputStream(fich_a_copiar); |
|
|
|
|
|
|
|
FileInputStream in = new FileInputStream(fich_a_copiar); |
|
|
|
DataInputStream din = new DataInputStream(in); |
|
|
|
FileOutputStream out = new FileOutputStream(fich); |
|
|
|
DataOutputStream dout = new DataOutputStream(out); |
|
|
|
|
|
|
|
int cal=0; |
|
|
|
int i=0; |
|
|
|
int c; |
|
|
|
ArrayList bufferin = new ArrayList(); |
|
|
|
|
|
|
|
while((c =din.read()) != -1 && bufferin.add(c)) { |
|
|
|
while((c = din.read() ) != -1 && bufferin.add(c)) { |
|
|
|
System.out.println(calculando[cal]); |
|
|
|
cal++; |
|
|
|
if (cal >= 4) |
|
|
|
cal = 0; |
|
|
|
|
|
|
|
try { |
|
|
|
Thread.sleep(100); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
// TODO Auto-generated catch block |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for(int j = 0; j<bufferin.size(); j++) { |
|
|
|
|
|
|
|
int porcentaje = (j*100)/bufferin.size(); |
|
|
|
System.out.println(porcentaje + "%"); |
|
|
|
for(int q = 0; q<porcentaje; q++) { |
|
|
|
System.out.println(porcentaje+1 + "%"); |
|
|
|
for(int q = 0; q<=porcentaje+1; q++) { |
|
|
|
System.out.print("@"); |
|
|
|
} |
|
|
|
for(int q = porcentaje; q<100; q++) { |
|
|
|
for(int q = porcentaje+1; q<100; q++) { |
|
|
|
System.out.print("_"); |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println(""); |
|
|
|
|
|
|
|
|
|
|
|
dout.write((int) bufferin.get(j)); |
|
|
|
} |
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
// TODO Auto-generated catch block |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (IOException e) { |
|
|
|
// TODO Auto-generated catch block |
|
|
|
e.printStackTrace(); |
|
|
|
dout.write((int)bufferin.get(j)); |
|
|
|
try { |
|
|
|
Thread.sleep(40); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
// TODO Auto-generated catch block |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|