keyview 调用使用流程(Filtering in Stream Mode)

本文介绍如何使用过滤流模式进行文件处理。首先加载kvfilter库并获取KV_GetFilterInterfaceEx()入口点,通过调用fpInit()初始化过滤会话。接着创建输入流并打开流,定义KVOpenFileArg结构以打开源文件。通过调用fpGetMainFileInfo()判断文件是否为容器文件,并进一步处理子文件。最后通过fpFilterStream()过滤流,完成整个流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Filtering in Stream Mode

To use the Filtering stream-based I/O

  1. Load the kvfilter library and obtain the KV_GetFilterInterfaceEx() entry point. The filter sample program contains sample code for all platforms.
  2. Initialize a filter session by calling fpInit() or fpInitWithLicenseData(). This function's return value, pContext, is passed as the first argument to all other Filter functions.
  3. Pass the context pointer from fpInit() or fpInitWithLicenseData() and the address of a structure that contains pointers to the File Extraction API functions in the call to KVGetExtractInterface(). See KVGetExtractInterface().
  4. Create an input stream (KVInputStream) by calling fpFiletoInputStreamCreate() or by using code similar to the example code in the Filter sample program.
  5. Open the stream by calling fpOpenStream().
  6. Declare the input stream in the KVOpenFileArg structure.
  7. Open the source file by calling fpOpenFile() and passing the KVOpenFileArg structure. This call defines the parameters necessary to open a file for extraction.
  8. Determine whether the source file is a container file (that is, whether it contains subfiles) by calling fpGetMainFileInfo().
  9. If the call to fpGetMainFileInfo() determined that the source file is a container file, proceed to step 10; otherwise, proceed to step 13.
  10. Determine whether the subfile is a container file by calling fpGetSubFileInfo().
  11. Extract the subfile to a stream by calling fpExtractSubFile().
  12. If the call to fpGetSubFileInfo() determined that the subfile is a container file, repeat step 4 through step 11 until all subfiles are extracted; otherwise, proceed to step 13.
  13. Filter the stream by calling fpFilterStream(). Call fpFilterStream() repeatedly until the entire output buffer is processed. After each call to fpFilterStream(), call fpFreeFilterOutput() to free the text buffer returned.
  14. Close the stream by calling fpCloseStream().
  15. Free the memory allocated for the input stream by calling fpFileToInputStreamFree().
  16. Close the file by calling fpCloseFile().
  17. Repeat Step 4 through Step 16 as required for additional source files.
  18. Terminate the filter session by calling fpShutdown().
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值