查看PGPUtil的来源,您可以看到直接使用流或数组时要调用的API:
public static void writeFileToLiteralData(OutputStream out, char fileType, File file, byte[] buffer) throws IOException { PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); OutputStream pOut = lData.open(out, fileType, file.getName(), new Date(file.lastModified()), buffer); FileInputStream in = new FileInputStream(file); byte[] buf = new byte[buffer.length]; int len; while ((len = in.read(buf)) > 0) { pOut.write(buf, 0, len); } lData.close(); in.close();}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)