Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
black_apple_yyx committed Jul 19, 2019
1 parent e7901f4 commit b7376b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/yyx/xf/tool/document/file/util/UtilFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,16 @@ public static File writeInFile(String content, String filePath) {
}
return new File(filePath);
}

public static File bytesConvertToFile(byte[] bytes, String filePath) throws FileNotFoundException {
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
FileChannel channel = fileOutputStream.getChannel();
ByteBuffer allocate = ByteBuffer.wrap(bytes);
try {
channel.write(allocate);
} catch (IOException e) {
e.printStackTrace();
}
return new File(filePath);
}
}

0 comments on commit b7376b4

Please sign in to comment.