/** * Encodes or decodes two files from the command line; * <strong>feel free to delete this method (in fact you probably should) * if you're embedding this code into a larger program.</strong> */ public static final void main(final String[] args) { if (args.length < 3) { Base64.usage("Not enough arguments."); } // end if: args.length < 3 else { String flag = args[0]; String infile = args[1]; String outfile = args[2]; if (flag.equals("-e")) { Base64.encodeFileToFile(infile, outfile); } // end if: encode else if (flag.equals("-d")) { Base64.decodeFileToFile(infile, outfile); } // end else if: decode else { Base64.usage("Unknown flag: " + flag); } // end else } // end else } // end main
/** * Encodes or decodes two files from the command line; * <strong>feel free to delete this method (in fact you probably should) * if you're embedding this code into a larger program.</strong> */ public final static void main(final String[] args) { if (args.length < 3) { Base64.usage("Not enough arguments."); } // end if: args.length < 3 else { String flag = args[0]; String infile = args[1]; String outfile = args[2]; if (flag.equals("-e")) { Base64.encodeFileToFile(infile, outfile); } // end if: encode else if (flag.equals("-d")) { Base64.decodeFileToFile(infile, outfile); } // end else if: decode else { Base64.usage("Unknown flag: " + flag); } // end else } // end else } // end main