ds.ov2.util
Class APDU_short

java.lang.Object
  extended by ds.ov2.util.APDU_short
All Implemented Interfaces:
APDU_Serializable

public class APDU_short
extends Object
implements APDU_Serializable

APDU_Serializable wrapper around a short.

CPP Preprocessing
This class uses the following cpp defines: PACKAGE, PUBLIC, ASSERT, JAVACARD_APPLET
Execution Environment:
host, card
Author:
Hendrik Tews
Version:
$Revision: 1.11 $
Last Commit:
$Date: 2009-06-19 20:37:36 $ by $Author: tews $

Field Summary
 short value
          The wrapped short value.
 
Constructor Summary
APDU_short()
          Default initialization.
APDU_short(int i)
          Initialize to i.
APDU_short(short s)
          Initialize to s.
 
Method Summary
 void copy(int i)
          Copy i into value.
 short from_byte_array(short len, short this_index, byte[] byte_array, short byte_index)
          Deserialize this short.
 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)
          Serialize this short.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public short value
The wrapped short value.

Constructor Detail

APDU_short

public APDU_short()
Default initialization.


APDU_short

public APDU_short(short s)
Initialize to s.

Parameters:
s - short to wrap

APDU_short

public APDU_short(int i)
Initialize to i. Asserts that i fits into a short.

Only available if JAVACARD_APPLET is undefined.

Parameters:
i - value to wrap
Method Detail

copy

public void copy(int i)
Copy i into value. Asserts that i fits into a short.

Only available if JAVACARD_APPLET is undefined.

Parameters:
i - value to wrap

size

public short size()
Size in bytes necessary to send or receive this object via the OV-chip protocol layer, see APDU_Serializable.size().

Specified by:
size in interface APDU_Serializable
Returns:
2

is_compatible_with

public boolean is_compatible_with(Object o)
Compatibility check for the OV-chip protocol layer. See the compatibility check explanations and also APDU_Serializable.is_compatible_with.

This object is compatible with any other instance of APDU_short.

Specified by:
is_compatible_with in interface APDU_Serializable
Parameters:
o - actual argument or result
Returns:
true if o is an instance of APDU_short

to_byte_array

public short to_byte_array(short len,
                           short this_index,
                           byte[] byte_array,
                           short byte_index)
Serialize this short. See APDU_Serializable.to_byte_array.

Specified by:
to_byte_array in interface APDU_Serializable
Parameters:
len - available space in byte_array
this_index - number of bytes that have already been written in preceeding calls
byte_array - data array to serialize the state into
byte_index - index in byte_array
Returns:
the number of bytes actually written, except for the case where serialization finished by writing precisely len bytes, in this case len + 1 is returned.

from_byte_array

public short from_byte_array(short len,
                             short this_index,
                             byte[] byte_array,
                             short byte_index)
Deserialize this short. See APDU_Serializable.from_byte_array.

Specified by:
from_byte_array in interface APDU_Serializable
Parameters:
len - available data in byte_array
this_index - number of bytes that have already been read in preceeding calls
byte_array - data array to deserialize from
byte_index - index in byte_array
Returns:
the number of bytes actually read, except for the case where deserialization finished by reading precisely len bytes, in this case len + 1 is returned.