【发布时间】:2016-06-02 08:40:29
【问题描述】:
我的代码遇到了一些问题。
当我每次尝试使用函数Files.write write 将文件byte[](例如长度为173517)写入文件随机字节(例如3355)时,我得到一个不同的值。
这是我的代码:
byte[] dataBytes = Files.readAllBytes(Paths.get(file.getAbsolutePath()));
byte[] cipByte = cipher.doFinal(dataBytes);
byte[] encr = Base64.getEncoder().encode(cipByte);
Files.write(Paths.get(encryptedFile.getAbsolutePath()), encr); //encr len = 173517
【问题讨论】: