Advertisement
Guest User

CIFRADO (escritura metodizada)

a guest
Apr 1st, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. import java.io.*;
  3. import java.util.Scanner;
  4.  
  5. public class Cifrado {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. String nombreFicheroEntrada = (args[0]);
  10. String nombreFicheroSalida = (args[0]).concat(".cfr");
  11. int clave = Integer.parseInt(args[1]);
  12.  
  13. //
  14. String linea = "";
  15.  
  16. File f;
  17.  
  18. f = new File(nombreFicheroEntrada);
  19.  
  20. Scanner scFile = null;
  21. try {
  22. scFile = new Scanner(f, "UTF-8");
  23. while (scFile.hasNextLine()) {
  24. linea = scFile.nextLine();
  25. Utils.escribelo(nombreFicheroSalida, linea, clave); //METODO ESCRIBELO
  26.  
  27. }
  28. // System.out.println("Linea: \n" + linea);
  29. } catch (Exception e) {
  30. System.out.println("Se ha producido un error");
  31. } finally {
  32. if (scFile != null) {
  33. scFile.close();
  34. }
  35. }
  36.  
  37.  
  38. }
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement