Top Description Fields Constructors Methods
org.osgi.service.zigbee.types

pack-priv Class ZigBeeDefaultSerializer

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, org.osgi.service.zigbee.ZigBeeDataInput, .ZigBeeDataOutput, .ZigBeeDataTypes

This class contains the common serialize/deserialize methods for all the org.osgi.service.zigbee.types.* classes. The array, bag, set, structure data types are not supported.
Author
$Id: f2f2ea5f790a3c821db2faeea7a4dd1eba8ae3fb $

Field Summary

Modifier and TypeField and Description
pack-priv static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static Object

Returns:

The deserialized object. The returned value is null if the deserialized value is equal to the Invalid Value for the specified dataType.
deserializeDataType
(ZigBeeDataInput
A valid ZigBeeDataInput stream instance. This parameter cannot be null.
is
,
short
The data type that have to be deserialized. This value must be one of the valid data types constants defined at the beginning of this interface, otherwise an IllegalArgumentException exception is thrown.
dataType
)

Unmarshal ZigBeeDataInput stream, according the dataType argument.

pack-priv static void
serializeDataType(ZigBeeDataOutput
a ZigBeeDataOutput stream where to stream the value. This parameter cannot be null. If it is nul a NullPointerException is thrown.
os
,
short
The data type that have to be marshaled on the output stream.
dataType
,
Object
The value that have to be serialized on the output stream. If null is passed this method outputs on the stream the ZigBee invalid value related to the specified data type. If the data type do not allow any invalid value and the passed value is null an IllegalArgumentException is thrown.
value
)

Marshal the passed value into a ZigBeeDataOutput stream, according the dataType argument.

private static byte[]
swap(byte[] array)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

zigBeeTimeZeroback to summary
pack-priv static final long zigBeeTimeZero

Constructor Detail

ZigBeeDefaultSerializerback to summary
pack-priv ZigBeeDefaultSerializer()

Method Detail

deserializeDataTypeback to summary
pack-priv static Object deserializeDataType(ZigBeeDataInput is, short dataType) throws IOException

Unmarshal ZigBeeDataInput stream, according the dataType argument. An IllegalArgumentException is thrown when the passed value does not belong to the class allowed for the dataType.

Array, bag, set and structure data types are not supported.

Parameters
is:ZigBeeDataInput

A valid ZigBeeDataInput stream instance. This parameter cannot be null.

dataType:short

The data type that have to be deserialized. This value must be one of the valid data types constants defined at the beginning of this interface, otherwise an IllegalArgumentException exception is thrown.

Returns:Object

The deserialized object. The returned value is null if the deserialized value is equal to the Invalid Value for the specified dataType.

Exceptions
IOException:
in case of problems while deserializing the ZigBeeDataInput. For instance this could happen if in the stream the remaining bytes are not enough to be able to unmarshal the requested data type.
IllegalArgumentException:
if the passed dataType is not supported.
NullPointerException:
if the passed ZigBeeDataInput is null.
serializeDataTypeback to summary
pack-priv static void serializeDataType(ZigBeeDataOutput os, short dataType, Object value) throws IOException

Marshal the passed value into a ZigBeeDataOutput stream, according the dataType argument. An IllegalArgumentException is thrown when the passed value does not belong to the class allowed for the dataType.

Array, bag, set and structure data types are not supported.

If the data type allows that, a null value is marshaled into ZCL Invalid Value for that data type.

Parameters
os:ZigBeeDataOutput

a ZigBeeDataOutput stream where to stream the value. This parameter cannot be null. If it is nul a NullPointerException is thrown.

dataType:short

The data type that have to be marshaled on the output stream.

value:Object

The value that have to be serialized on the output stream. If null is passed this method outputs on the stream the ZigBee invalid value related to the specified data type. If the data type do not allow any invalid value and the passed value is null an IllegalArgumentException is thrown.

Exceptions
IllegalArgumentException:
Thrown when the passed value does not belong to the allowed class for the dataType as described in the specification or when the value exceed the range allowed by that type (for example, length for Octet String data types).
swapback to summary
private static byte[] swap(byte[] array)