Developing OTDs for Application Adapters

unmarshal(byte[] in, String charset) Method

This method populates the OTD using the data supplied in the byte array in. The charset argument specifies the encoding of the given data. The specified encoding becomes the current encoding of the OTD, and is used when data is subsequently marshaled without an overriding encoding; e.g., as allowed in a marshal (OtdOutputStream, String) call. If the specified charset value does not name a supported character set or names a supported charset with one-way encoding (one that can decode or encode, but not both), a java.io.UnsupportedEncodingException is generated.

Table 1–14 unmarshal(byte[] in, String charset) Method

Syntax 

Throws 

Examples 

void unmarshal(byte[] in, String charset) 

Unmarshal 

Exception, IOException, UnsupportedEncodingException 

byte[] bytes = ...cocoOtd.unmarshal(bytes, "cp037"); // Interpret bytes content as EBCDIC datacocoOtd.unmarshal(bytes, "US-ASCII"); // Interpret bytes content as ASCII data