3.1.1.11.2.7 RunCompressionAlgorithm

 procedure RunCompressionAlgorithm (
     compressData : boolean,
     compressionFormat : CLAIMS_COMPRESSION_FORMAT,
     pInByteArray : BYTE ARRAY,
     ulBufferSizeinBytes : ULONG,
     pOutByteArray : ADDRESS OF BYTE ARRAY,
     pOutByteArraySizeinBytes : ADDRESS OF ULONG)

This is a helper method that implements the compression and decompression algorithms listed in section 2.2.18.4. This method compresses or decompresses the given input data using the algorithm identified by the input compressionFormat parameter. If the compression algorithm encounters an error during its operation, the output byte array is cleared.

compressData: Specifies the compression direction. If set to TRUE, this method compresses the input data; otherwise, the method decompresses the input data.

compressionFormat: Specifies the compression or decompression algorithm.

pInByteArray: The input byte array of size ulBufferSizeinBytes that is to be compressed or decompressed.

ulBufferSizeinBytes: The size of the input byte array.

pOutByteArray: The address of the output byte array.

pOutByteArraySizeinBytes: The address of a ULONG that will contain the size of the output byte array.

Return Values: This procedure does not return a value.

Logical Processing:

 pOutByteArray^ := null;
 pOutByteArraySizeinBytes^ := null;
  
 if (compressionFormat = COMPRESSION_FORMAT_LZNT1)
     if compressData
          pOutByteArray^ := CompressUsing_LZNT1;
     else
          pOutByteArray^ := UncompressUsing_LZNT1;
     endif 
 else if (compressionFormat = COMPRESSION_FORMAT_XPRESS)
     if compressData
          pOutByteArray^ := CompressUsing_XPRESS;
     else
          pOutByteArray^ := UncompressUsing_XPRESS;
     endif
 else if (compressionFormat = COMPRESSION_FORMAT_XPRESS_HUFF)
     if compressData
          pOutByteArray^ := CompressUsing_XPRESS_HUFF;
     else
          pOutByteArray^ := UncompressUsing_XPRESS_HUFF;
     endif
 else
     pOutByteArray^ := ADDRESS OF pInByteArray;
     pOutByteArraySizeinBytes^ := ulBufferSizeinBytes;
 endif
  
 return;