JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS Custom Encoders User's Guide     Java CAPS Documentation
search filter icon
search icon

Document Information

Designing Custom Encoders

Understanding the Encoder Framework

Abstract Message Structure

Parent, Child, and Sibling Nodes

Root Nodes

Non-leaf Nodes

Leaf Nodes

Creating the Abstract Message Definition

Recursive Structure

Binary Data Types

Applying Custom Encoding to an XSD

To Apply the Custom Encoder to an XSD

Editing Encoding Properties

Encoding Properties

Node Type Default Values

Order Property

Data Encoding

Matching Data Patterns

Defining Byte Patterns

Specifying Pattern Alignment

Specifying Delimiters

Delimiter List

Delimiter Properties

Delimiter Levels

Delimiter Type

Escape Option

Precedence

Optional

Terminator

Delimiter Characters (Bytes)

Escape Sequences

Multiple Delimiters

Anchored and Detached Delimiters

Begin and End Delimiters

Constant and Embedded Delimiters

Defining a Delimiter List

To create a delimiter list

Validating and Testing the Custom Message Definition

Validating the Custom Message Definition

Testing the Encoder Runtime Behavior

Using Custom Encoders in JBI Projects

To Use a Custom Encoder in a JBI Project

About Data Parsing and Serialization

Encoding Process

encodeToString() Method

encodeToBytes() Method

encodeToStream() Method

encodeToWriter() Method

Decoding Process

decodeFromString() Method

decodeFromBytes() Method

decodeFromStream() Method

decodeFromReader() Method

Setting Delimiters

About Data Parsing and Serialization

The parsing and serializing operations require data to be in byte-array form, so different methods for encoding and decoding data must be used to accommodate different input and output data formats. These different methods incorporate various stages of character conversion using specific character sets.

Encoding Process

Internally, the encoder requires the data input and output to be in bytes. The encoding process uses the serializing charset, as illustrated in the following figure.

Figure 24 Encoding Process

image:Figure described in content.

encodeToString() Method

The encodeToString() method requires conversion to produce an output string after encoding from a byte[] field. This method also requires conversion when encoding from a string field, since the parser requires the data in bytes, and conversion again to produce an output string. The encodeToString() process uses the serializing charset, as illustrated in the following figure.

Figure 25 encodeToString()

image:Figure described in content.

encodeToBytes() Method

The encodeToBytes() method requires conversion to produce bytes after encoding from a string field. Following serialization, this method also requires conversion to produce an output (in bytes) having a different format from that used by the parser. If the same format is desired, then the output charset is left undefined, the serializing charset property is substituted by default, and the double conversion is bypassed. The encodeToBytes() process uses both the serializing charset and the output charset, as illustrated in the following figure.

Figure 26 encodeToBytes()

image:Figure described in content.

encodeToStream() Method

Encodes an XML representation of a message into an OutputStream object, encoded in custom format.

encodeToWriter() Method

Encodes an XML representation of a message into a Writer object, encoded in custom format.

Decoding Process

Internally, the decoding process requires conversion when decoding to a string field, since the input is in bytes as required by the parser. The decoding process uses the parsing charset, as illustrated in the following figure.

Figure 27 Decoding Process

image:Figure described in content.

decodeFromString() Method

The decodeFromString() method requires conversion of the input string, since the parser requires the data in bytes. This method requires a second conversion when decoding to a string field. The decodeFromString() process uses the parsing charset, as illustrated in the following figure.

Figure 28 decodeFromString()

image:Figure described in content.

decodeFromBytes() Method

The decodeFromBytes() method requires conversion if the input data has a different byte format from that used by the parser. If the same format is desired, then the input charset is left undefined, the parsing charset is substituted by default, and the double conversion is bypassed. After parsing, this method requires further conversion if decoding to a string field. The decodeFromBytes() process uses both the input charset and the parsing charset, as illustrated in the following figure.

Figure 29 decodeFromBytes()

image:Figure described in content.

decodeFromStream() Method

Decodes an InputStream object encoded in custom format into an XML-encoded message.

decodeFromReader() Method

Decodes a Reader object encoded in custom format into an XML-encoded message.

Setting Delimiters

The following figure illustrates how the delimiter gets set and passed into the parser.

Figure 30 Setting Delimiters

image:Figure described in content.

As an example, if you select a delimiter in the XSD Editor by hex code (such as \x7C), it is passed directly into the parser. If you type the delimiter in as a pipe (|), however, then the pipe character is first converted to hex code, using the GUI’s encoding, and then sent to the parser.