cpiBufferSize

目的

获取到包含表示输入消息的位流表示的缓冲区的大小,获取指定的解析器对象。

语法

CciSize cpiBufferSize(
  int*                returnCode,
  CciParser*  parser);

参数

returnCode
接收来自函数(输出)的返回码。可能的返回码是:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_PARSER_OBJECT
  • CCI_NO_BUFFER_EXISTS
parser
指定解析器对象的地址(输入)。

返回值

如果成功,返回缓冲区的大小(以字节为单位)。如果发生错误,则会返回零(CCI_NULL_ADDR),并且 returnCode 会表明发生错误的原因。

样本

此示例取自样本节点文件 BipSampPluginParser.c(428 行到 452 行):

int cpiParseBufferEncoded(
  CciParser*  parser,
  CciContext* context,                
  int         encoding,
  int         ccsid
){
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
  int             rc;
  /* Get a pointer to the message buffer and set the offset */
pc->iBuffer = (void *)cpiBufferPointer(&rc, parser);
pc->iIndex = 0;  /* Save the format of the buffer */
pc->iEncoding = encoding;
pc->iCcsid = ccsid;
  /* Save size of the buffer */
pc->iSize = cpiBufferSize(&rc, parser);
相关概念
用户定义的解析器
用户定义的扩展
相关任务
使用 C 创建解析器
相关参考
cpiAppendToBuffer
cpiBufferByte
cpiBufferPointer
C 解析器实用程序函数
声明 | 商标 | 下载 | | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后更新:2006/05/19
as08290_