Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- public class Converter {
- public byte[] toByteArray(String PATH){
- Path path = Paths.get(PATH);
- try {
- return Files.readAllBytes(path);
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
- public void createFileformByteArray(String Filename,byte[] bytes){
- try {
- FileOutputStream fileOuputStream = new FileOutputStream(Filename);
- fileOuputStream.write(bytes);
- fileOuputStream.close();
- } catch (Exception e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement