IBM Integration Bus, Version 10.0.0.0 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


cpiWriteBufferFormatted

This function extends the capability of the cpiWriteBuffer() implementation function by providing additional information about the output message.

The following additional information is provided:
  1. The encoding and coded character set that the output message is represented in when the parser serializes its element tree to an output bit stream.
  2. The message set, type, and format for the output message for those parsers which require such information to correctly serialize its element tree to an output bit stream.

If serialization is not required, for example when the output is based on an input bit stream, and the tree has not been modified, this implementation function will not be invoked by the integration node.

If this implementation function is provided in the CPI_VFT structure, you cannot specify either cpiWriteBuffer() or cpiWriteBufferEncoded(); if you do, the cpiDefineParserClass() function fails with a return code of CCI_INVALID_IMPL_FUNCTION.

Defined In Type Member
CPI_VFT Conditional iFpWriteBufferFormatted

Syntax

int cpiWriteBufferFormatted(
  CciParser*     parser,
  CciContext*    context,
  int            encoding,
  int            ccsid,
  CciChar*       set,
  CciChar*       type,
  CciChar*       format); 

Parameters

parser
The address of the parser object (input).
context
The address of the context owned by the parser object (input).
encoding
The encoding of the message buffer (input).
ccsid
The CCSID of the message buffer (input).
set
The message set to which the message belongs (input).
type
The message type (input).
format
The message format (input).

Return values

The size in bytes of the data appended to the bit stream in the buffer.

Sample

int cpiWriteBufferFormatted(
  CciParser*  parser,
  CciContext* context,
  int         encoding,
  int         ccsid
  CciChar*       set,
  CciChar*       type,
  CciChar*       format
){
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
  int                initialSize = 0;
  int                rc = 0;
  const void* a;
  CciByte b;

  
  initialSize = cpiBufferSize(&rc, parser);
  a = cpiBufferPointer(&rc, parser);
  b = cpiBufferByte(&rc, parser, 0);

  cpiAppendToBuffer(&rc, parser, (char *)"Some test data", 14);

  return cpiBufferSize(0, parser) - initialSize;
}

as08230_.htm | Last updated 2015-03-27 19:27:21