我想以镶木地板格式将数据写入加密的输出流。
所有示例和API(parquet-avro,parquet-hadoop,parquet-common)都需要写入文件路径,我可以直接将parquet写入输出流吗?
流程示例代码:
public void encryptedOS(GenericRecord record){
PGPEncryptedDataGenerator encryptedDataGenerator = new PGPEncryptedDataGenerator(encryptorBuilder);
PGPPublicKey encKey = cachedKey[DEorKE].pgpPublicKey;
encryptedDataGenerator.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(encKey).setProvider(BC));
OutputStream encryptedOutputStream = encryptedDataGenerator.open(os, new byte[BUFFER_SIZE]);
byte[] buffer = new byte[BUFFER_SIZE];
PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator();
OutputStream pOut = lData.open(encryptedOutputStream, PGPLiteralData.BINARY, new Date(), buffer);
ParquetOutputStream wrappedOS = ((ParquetOutputStream) pOut).wrapOutputStream();
writeData(wrappedOS, record);
}
public void writeData(ParquetOutputStream wrappedOS, GenericRecord record){
wrappedOS.write(record);
}
感谢任何建议,谢谢!