Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author anton
- */
- public class Cifrado {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- // String texto = "";
- String nombre;
- StringBuilder linea = new StringBuilder();
- int clave;
- if (args.length == 0) {
- nombre = "C:\\Users\\anton\\Documents\\Proramacion\\CSVs\\texto.txt";
- clave = 1;
- } else {
- nombre = args[0];
- clave = Integer.parseInt(args[1]);
- }
- File f = new File(nombre);
- if (!f.exists()) {
- System.out.println("El fichero no existe");
- } else {
- Scanner scFile = null;
- try {
- scFile = new Scanner(f);
- while (scFile.hasNextLine()) {
- linea.append(scFile.nextLine() + "\n");
- }
- } catch (Exception e) {
- System.out.println("Se ha producido un error");
- }
- }
- System.out.println(linea.toString());
- System.out.println(Utils.cifradoCesar(linea, clave));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement