mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
hash & sm4 & cert(未测试)
This commit is contained in:
1 parent
e515af4123
commit
3868d65fae
26 files changed
+1873
-15
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
public class FileUtil {
|
||||
public static void writeFile(String filePath, byte[] data) throws IOException {
|
||||
RandomAccessFile raf = null;
|
||||
try {
|
||||
raf = new RandomAccessFile(filePath, "rw");
|
||||
raf.write(data);
|
||||
} finally {
|
||||
if (raf != null) {
|
||||
raf.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] readFile(String filePath) throws IOException {
|
||||
RandomAccessFile raf = null;
|
||||
byte[] data;
|
||||
try {
|
||||
raf = new RandomAccessFile(filePath, "r");
|
||||
data = new byte[(int) raf.length()];
|
||||
raf.read(data);
|
||||
return data;
|
||||
} finally {
|
||||
if (raf != null) {
|
||||
raf.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user