RosettaCodeData/Task/Base64-decode-data/Java/base64-decode-data-2.java

7 lines
249 B
Java

void decodeToFile(String path, byte[] bytes) throws IOException {
try (FileOutputStream stream = new FileOutputStream(path)) {
byte[] decoded = Base64.getDecoder().decode(bytes);
stream.write(decoded, 0, decoded.length);
}
}