ECI resource adapter CICS-specific records using the streamable interface

For input and output, the ECI resource adapter supports only records that implement the javax.resource.cci.Streamable interface. Start of changeMappedRecords that are used to make up channels and containers also conform to this interfaceEnd of change. The javax.resource.cci.Streamable interface allows the ECI resource adapter to read streams of bytes that make up the CICS® COMMAREAs Start of changeor channels and containersEnd of change directly from, and write them to, the Record objects supplied to the execute() method of ECIInteraction. The following example shows how to build a record for use as input by the ECI resource adapter, using the method supplied in the javax.resource.cci.Streamable interface.

Byte commarea[] = new byte[10];
ByteArrayInputStream stream = new ByteArrayInputStream(commarea);
Record in = new RecordImpl();
in.read(stream);
int.execute(..., in, ...);

To retrieve a byte array from the output record, the reverse of the process shown in the above example can be achieved by using the output records write() method using a ByteArrayOutputStream object as the parameter. The streams toByteArray() method will then provide the CICS COMMAREA Start of changeor channel and containerEnd of change output in the form of a byte array. In the above example a class called RecordImpl is used as the concrete implementation class of the javax.resource.cci.Record interface. To provide more functionality for your specific J2EE components, you can write implementations of the Record interface that allow you to set the contents of the record using the constructor. This avoids the use of the ByteArrayInputStream used in the above example. A managed environment may provide tools that allow you to build implementations of the Record interface that are customized for your J2EE components needs without writing any code.