|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.util.Serializable_array
public abstract class Serializable_array
Abstract class providing the APDU_Serializable
interface
for arrays of APDU_Serializable's.
This abstract class implements the APDU_Serializable
interface
for data types that contain several APDU_Serializable's of possibly
different type or size. Clients only need to override the get_array()
, and the
is_compatible_with
method.
Overriding get_length()
is necessary for clients
that can change their size for testing purposes.
Overriding size()
is optional.
Overriding to_byte_array
and from_byte_array
makes not much sense, execpt for special purposes, such as
performing side effects before serialization starts or after
deserialization finshes.
Constructor Summary | |
---|---|
protected |
Serializable_array()
Disabled constructor. |
Method Summary | |
---|---|
short |
from_byte_array(short len,
short this_index,
byte[] byte_array,
short byte_index)
Deserialization of this object for the OV-chip protocol layer. |
protected abstract APDU_Serializable[] |
get_array()
Array of objects to (de-)serialize. |
short |
get_length()
Length of the serializable array. |
boolean |
is_compatible_with(Object o)
Compatibility check for the OV-chip protocol layer. |
short |
size()
Size in bytes necessary to send or receive this object via the OV-chip protocol layer, see APDU_Serializable.size() . |
short |
to_byte_array(short len,
short this_index,
byte[] byte_array,
short byte_index)
Serialization of this object for the OV-chip protocol layer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Serializable_array()
Method Detail |
---|
protected abstract APDU_Serializable[] get_array()
Clients must override this method.
public short get_length()
get_array
().length
to determine the size of the array returned from
get_array()
. The returned value must be greater than zero
and less than or equal to the actual array size.
The default implementation returns
get_array
().length
. By overriding
clients can provide the illusion
of a shorter array without the need of reallocating this shorter
array.
get_array()
public short size()
APDU_Serializable.size()
.
The default implementation used
Misc.length_of_serializable_array
to determine the size.
Can be overriden for homegenous arrays that can determine their size more efficiently.
size
in interface APDU_Serializable
public boolean is_compatible_with(Object o)
APDU_Serializable.is_compatible_with
.
The default implementation returns false, which is the right value for all host data types. Card data types must override this method.
is_compatible_with
in interface APDU_Serializable
o
- actual argument or result
o
.public short to_byte_array(short len, short this_index, byte[] byte_array, short byte_index)
APDU_Serializable.to_byte_array
.
Overriding makes little sense, except when side effects must be scheduled before the start or after the end of serialization.
to_byte_array
in interface APDU_Serializable
len
- available space in byte_array
this_index
- number of bytes that
have already been written in preceeding callsbyte_array
- data array to serialize the state intobyte_index
- index in byte_array
len
bytes, in this case len + 1
is
returned.public short from_byte_array(short len, short this_index, byte[] byte_array, short byte_index)
APDU_Serializable.from_byte_array
.
Overriding makes little sense, except when side effects must be scheduled before the start or after the end of serialization.
from_byte_array
in interface APDU_Serializable
len
- available data in byte_array
this_index
- number of bytes that
have already been read in preceeding callsbyte_array
- data array to deserialize frombyte_index
- index in byte_array
len
bytes, in this case len + 1
is
returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |