|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.bignat.APDU_BigInteger
public class APDU_BigInteger
Mutable APDU_Serializable
wrapper around
BigInteger
. This is a host data type with
Bignat
as corresponding card data type. Its purpose is
to wrap BigInteger arguments and results for the OV-chip protocol layer.
Wrapping and unwrapping will be done by the stub code, which is
generated by the idl compiler. Therefore, high-level host code should
not at all come in contect with APDU_BigInteger's. High-level host
code can use BigIntegers for its computations and can also pass
BigIntegers into the method stubs of the OV-chip protocol layer. The
OV-chip protocol layer will send the byte array of the BigInteger to the card,
where it is copied into a Bignat, silently performing a data
type conversion.
The BigIntegers (which are wrapped here) stay immutable. Mutability of this class is achived by changing a reference to a BigInteger.
For a number of general topics see also the package description.
Field Summary | |
---|---|
private byte[] |
buf
Internal (de-)serialization buffer. |
short |
max_size
Maximal size of the wrapped BigInteger . |
BigInteger |
value
The wrapped BigInteger instance. |
Constructor Summary | |
---|---|
APDU_BigInteger(short max_size)
Receiving constructor. |
|
APDU_BigInteger(short max_size,
BigInteger value)
Sending constructor. |
Method Summary | |
---|---|
short |
from_byte_array(short len,
short this_index,
byte[] byte_array,
short byte_index)
Deserialization of the wrapped BigInteger for the OV-chip protocol layer. |
boolean |
is_compatible_with(Object o)
This is a host data type, nothing is compatible with it. |
short |
size()
Size in bytes necessary to send or receive this BigInteger 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 the wrapped BigInteger for the OV-chip protocol layer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public BigInteger value
max_size
bytes.
The size check will be done when to_byte_array
is called.
Because BigInteger are immutable, this reference changes when
deserialization (from_byte_array
) completes.
The reference might be null
before the first deserialization
completes. It must not be null
when serialization starts.
private byte[] buf
public final short max_size
BigInteger
. This maximal
size must equal the size of the Bignat
that this
BigInteger is sent to or received from. That is, (de-)serialization
uses always byte arrays of size max_size
.
Note that value
toByteArray()
might be one byte longer, because toByteArray occacionally adds
a leding zero byte.
Constructor Detail |
---|
public APDU_BigInteger(short max_size, BigInteger value)
max_size
- value
- public APDU_BigInteger(short max_size)
value
will stay null until set or deserialization completes.
max_size
- Method Detail |
---|
public short size()
APDU_Serializable.size()
.
size
in interface APDU_Serializable
max_size
public boolean is_compatible_with(Object o)
APDU_Serializable.is_compatible_with
.
is_compatible_with
in interface APDU_Serializable
o
- actual argument or result
public short to_byte_array(short len, short this_index, byte[] byte_array, short byte_index)
APDU_Serializable.to_byte_array
. Prior to serialization
value
must be non-null.
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
. After deserialization is
completed a new BigInteger is constructed from the received data
and assigned to value
.
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 |