Skip to content

Instantly share code, notes, and snippets.

@typelogic
Created October 23, 2020 12:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save typelogic/0567cdab6c15487c31496cb90006ff52 to your computer and use it in GitHub Desktop.
Save typelogic/0567cdab6c15487c31496cb90006ff52 to your computer and use it in GitHub Desktop.
base64decode.java
import java.nio.file.Paths;
import java.nio.file.Files;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
public class base64decode {
public static void main(String args[]) throws IOException {
if (args.length == 0) {
System.exit(1);
}
String strBase64 = new String(Files.readAllBytes(Paths.get(args[0])),
StandardCharsets.UTF_8);
byte[] buf = org.apache.commons.codec.binary.Base64.decodeBase64(strBase64);
String str = new String(buf);
System.out.print(str);
}
}
@typelogic
Copy link
Author

typelogic commented Oct 23, 2020

Run by: java -cp /path/to/commons-codec-1.12.jar:. base64decode /path/to/testfile.b64 > /tmp/output.bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment