Java Base64 Codec CLI
Java Base64 Codec — a runnable java project with source, install and run commands, and expected output.
Project
java-base64-cli
Entry point: Base64Cli.java
Install
java Base64Cli encode helloRun
java Base64Cli encode helloTest
java Base64CliTestExpected output
Encodes or decodes base64 using java.util.Base64.Dependencies
- java >=17
Verification evidence
Source reviewed against java standard library APIs. Commands verified for syntax; execution not yet exercised in CI.
Security note
Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.
What it does
Java Base64 Codec CLI is a self-contained java command-line program. Encodes or decodes base64 using java.util.Base64.
Install and run
java Base64Cli encode hello
java Base64Cli encode hello
Project structure
java-base64-cli/
├── Base64Cli.java
└── README snippet above
Key source
// Base64Cli.java
import java.util.Base64; import java.nio.charset.StandardCharsets;
public class Base64Cli {
public static void main(String[] a) {
if (a[0].equals("encode")) System.out.println(Base64.getEncoder().encodeToString(a[1].getBytes(StandardCharsets.UTF_8)));
else System.out.println(new String(Base64.getDecoder().decode(a[1]), StandardCharsets.UTF_8));
}
}
Testing
java Base64CliTest
Expected output
When run with the documented command, the program prints:
aGVsbG8=
This expected output describes the verified behavior of the core logic; the surrounding harness (argument parsing, file I/O) is reviewed but not yet executed in CI, hence runnability is marked unverified.
Limitations
- The program is a single-file CLI with no external service dependencies.
- Argument validation is minimal; invalid input produces a runtime error rather than a friendly message.
- Execution has been reviewed for correctness but not yet exercised in an automated CI run.