public interface CodecOperations
The formats of IOR components and service context data used by ORB services are often defined as CDR encapsulations encoding instances of IDL defined data types. The Codec
provides a mechanism to transfer these components between their IDL data types and their CDR encapsulation representations.
A Codec
is obtained from the CodecFactory
. The CodecFactory
is obtained through a call to ORB.resolve_initial_references( "CodecFactory" )
.
byte[] encode(Any data) throws InvalidTypeForEncoding
Converts the given any into a byte array based on the encoding format effective for this Codec
.
data
- The data, in the form of an any, to be encoded into a byte array.TypeCode
and the data of the type.InvalidTypeForEncoding
- thrown if the type is not valid for the encoding format effective for this Codec
.Any decode(byte[] data) throws FormatMismatch
Decodes the given byte array into an Any based on the encoding format effective for this Codec
.
data
- The data, in the form of a byte array, to be decoded into an Any.FormatMismatch
- is thrown if the byte array cannot be decoded into an Any.byte[] encode_value(Any data) throws InvalidTypeForEncoding
Converts the given any into a byte array based on the encoding format effective for this Codec. Only the data from the Any is encoded, not the TypeCode
.
data
- The data, in the form of an Any, to be encoded into a byte array.InvalidTypeForEncoding
- thrown if the type is not valid for the encoding format effective for this Codec
.Any decode_value(byte[] data, TypeCode tc) throws FormatMismatch, TypeMismatch
Decodes the given byte array into an Any based on the given TypeCode
and the encoding format effective for this Codec
.
data
- The data, in the form of a byte array, to be decoded into an Any.tc
- The TypeCode to be used to decode the data.FormatMismatch
- thrown if the byte array cannot be decoded into an Any.TypeMismatch
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.