|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.util.Resizable_buffer
public class Resizable_buffer
APDU_Serializable
wrapper around a byte array that can
provide the illusion of different sizes. Used in the test frame for
the OV-chip protocol layer. The resize method set_size
is always available in contrast to the test-frame-only
resize methods in the bignat library. The underlying byte array in
buf
does of course never change its size.
Field Summary | |
---|---|
byte[] |
buf
The buffer. |
private short |
size
Current size of the buffer. |
Constructor Summary | |
---|---|
Resizable_buffer(short max_size)
Convenience constructor for the host driver. |
|
Resizable_buffer(short max_size,
boolean in_ram)
Normal constructor. |
Method Summary | |
---|---|
short |
from_byte_array(short len,
short this_index,
byte[] byte_array,
short byte_index)
Deserialize this buffer. |
boolean |
is_compatible_with(Object o)
Compatibility check for the OV-chip protocol layer. |
void |
set_size(short size)
Set the pretended size. |
short |
size()
Current pretended size in bytes. |
short |
to_byte_array(short len,
short this_index,
byte[] byte_array,
short byte_index)
Serialize this buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private short size
buf
.length
.
public byte[] buf
size
field.
Constructor Detail |
---|
public Resizable_buffer(short max_size, boolean in_ram)
max_size
- maximal size of the buffer, this is also the
initial pretended sizein_ram
- allocate in transient RAM memory on the cardpublic Resizable_buffer(short max_size)
Resizable_buffer(max_size, false)
.
Only available if JAVACARD_APPLET
is not defined.
max_size
- maximal size of the buffer, this is also the
initial pretended size
Method Detail |
---|
public short size()
APDU_Serializable.size()
.
size
in interface APDU_Serializable
public void set_size(short size)
size
is larger than the
constructor
argument
max_size
, which determines the length of the underlying
byte array buf
, the set size request is ignored.
size
- new pretended size, should be smaller than the
max_size
argument of the constructor
.public boolean is_compatible_with(Object o)
APDU_Serializable.is_compatible_with
.
This object is only compatible to instances of this class with the same pretended size.
is_compatible_with
in interface APDU_Serializable
o
- actual argument or result
o
is an instance of Resizable_buffer
with the same pretended sizepublic short to_byte_array(short len, short this_index, byte[] byte_array, short byte_index)
APDU_Serializable.to_byte_array
.
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
.
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 |