package encrypt1; import java.io.*; import java.util.*; public class Encrypt1 { public static void main(String[] args) { if(args.length!2) ERROR MESSAGE { System.out.println("Invalid number of argumentss. Usage:src target"); } try { BufferedInputStream in = new BufferedInputStream (new FileInputStream(args[0])); // Create BufferedOutputStream from bos BufferedOutputStream out = new BufferedOutputStream (new FileOutputStream(args[1])); // Declare the variable num int buffer; // Checks content in the variable num is not equal to -1 while ((buffer=in.read())!=-1) { // Call the function Write() out.write(buffer+5); } System.out.println("Encrypted file saved"); } catch(IOException ex) { ex.printStackTrace(); } } }
package encrypt1;
import java.io.*;
import java.util.*;
public class Encrypt1 {
    public static void main(String[] args) {
       
        if(args.length!2)    ERROR MESSAGE        {
        System.out.println("Invalid number of argumentss. Usage:src target");
    }
        try {
       BufferedInputStream in = new BufferedInputStream (new FileInputStream(args[0])); 
        
        // Create BufferedOutputStream from bos 
        BufferedOutputStream out = new BufferedOutputStream (new FileOutputStream(args[1])); 
        
        // Declare the variable num
        int buffer;
        
        // Checks content in the variable num is not equal to -1
        while ((buffer=in.read())!=-1)
        {
        // Call the function Write()     
        out.write(buffer+5);
        
        }
        System.out.println("Encrypted file saved");
    }
    catch(IOException ex)
    {
        ex.printStackTrace();
    }
}
}

Let us see the correction
Step by step
Solved in 2 steps









