Advertisement
TrodelHD

Untitled

May 7th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package test;
  2.  
  3. import java.io.FileOutputStream;
  4. import java.io.IOException;
  5. import java.nio.file.Files;
  6. import java.nio.file.Path;
  7. import java.nio.file.Paths;
  8.  
  9. public class Converter {
  10. public byte[] toByteArray(String PATH){
  11. Path path = Paths.get(PATH);
  12. try {
  13. return Files.readAllBytes(path);
  14. } catch (IOException e) {
  15. e.printStackTrace();
  16. return null;
  17. }
  18. }
  19. public void createFileformByteArray(String Filename,byte[] bytes){
  20. try {
  21. FileOutputStream fileOuputStream = new FileOutputStream(Filename);
  22. fileOuputStream.write(bytes);
  23. fileOuputStream.close();
  24. } catch (Exception e) {
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement