bro*_*oat 5 java encryption base64 stdout
我有以下功能,它解密 base64 文件并将其写入 txt 文件。但是,我希望它输出到标准输出,而不是写入文本文件。你能建议我们如何做到这一点吗
CipherOutputStream cos = new CipherOutputStream(os, cipher);
doCopy(is, cos);
}
public static void doCopy(InputStream is, OutputStream os) throws IOException {
byte[] bytes = new byte[64];
int numBytes;
while ((numBytes = is.read(bytes)) != -1) {
os.write(bytes, 0, numBytes);
}
Run Code Online (Sandbox Code Playgroud)
因此,与其 os.write 将流写入 txt 文件,不如将其写入 stdout。
| 归档时间: |
|
| 查看次数: |
2519 次 |
| 最近记录: |