com.servingxml.components.flatfile.layout
Interface SignatureMethod

All Known Implementing Classes:
CrcSignatureMethod, SizeSignatureMethod

public interface SignatureMethod

Receive notification of the raw data from the body of a flat file (excluding header and trailer) as the file is being read or written. A file signature may be calculated from the raw data.

When the file is being written, data is called one or more times, followed by getSignature.

When the file is being read, data is called one or more times, followed by validate. A previously computed signature value is passed to validate, to compare against.


Method Summary
 void data(byte[] bytes, int start, int length)
          Receive notification of raw data from body of flat file.
 Value getSignature()
          Gets the value of the signature calculated in the data method
 void validate(Value expectedValue)
          Receive notification to validate the computed file signature against its expected value
 

Method Detail

data

void data(byte[] bytes,
          int start,
          int length)
Receive notification of raw data from body of flat file.

Data may be received in a single chunk or in multiple chunks.

Parameters:
bytes - the bytes from the body of the flat file.
start - the start position in the array
length - the number of characters to read from the array

validate

void validate(Value expectedValue)
Receive notification to validate the computed file signature against its expected value

Parameters:
expectedValue - the expected value of the file signature

getSignature

Value getSignature()
Gets the value of the signature calculated in the data method

Returns:
the signature value