Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------------------
- byte[] encodedBytes = Base64.encodeBase64("Test".getBytes());
- System.out.println("encodedBytes " + new String(encodedBytes));
- byte[] decodedBytes = Base64.decodeBase64(encodedBytes);
- byte[] fileBytes = Files.readAllBytes(Path.of("C:\\Users\\Adam\\IdeaProjects\\rental_server2\\logiAplikacji.log"));
- byte[] encodedBytesF = Base64.encodeBase64(fileBytes);
- String encodedFile= new String(encodedBytesF);
- FileWriter fileWriter= new FileWriter("zakodowanyPlik.txt");
- BufferedWriter bufferedWriter=new BufferedWriter(fileWriter);
- bufferedWriter.write(encodedFile);
- System.out.println(new String(encodedBytesF));
- byte[] decodedBytesF = Base64.decodeBase64(encodedBytesF);
- System.out.println(new String(decodedBytes));
- File logi=new File("Testuje czy dziala.log");
- FileOutputStream output = new FileOutputStream(logi);
- output.write(decodedBytesF);
- output.close();
- System.out.println("decodedBytes " + new String(decodedBytes));
- //--------------------------------------------------
Add Comment
Please, Sign In to add comment