com.gemplus.opencard.terminal
Class APDUDataInputStream
java.lang.Object
|
+--com.gemplus.opencard.terminal.APDUDataInputStream
- public class APDUDataInputStream
- extends java.lang.Object
Class APDUDataInputStream provides facilities to
decode an APDU response field. An input stream can be build
from a byte array or directly a ResponseAPDU object.
Stream can be read as byte, short or
int or arrays of those types.
- Version:
- $Id: APDUDataInputStream.java,v 1.1 1999/12/02 16:05:57 damke Exp $
- See Also:
ResponseAPDU,
APDUDataOutputStream
|
Method Summary |
int |
available()
Returns the number of remaining bytes available in the stream. |
boolean |
readBoolean()
Returns a boolean representation of the byte at current position
in the stream. |
boolean[] |
readBooleanArray()
Returns a boolean array representation of the
entire stream. |
boolean[] |
readBooleanArray(int size)
Returns a boolean array representation of the bytes
at the current position in the stream. |
byte |
readByte()
Returns the byte at current position in the stream. |
byte[] |
readByteArray()
Returns a byte array representation of the entire stream. |
byte[] |
readByteArray(int size)
Returns a byte array representation of the bytes at the
current position in the stream. |
int |
readInt()
Returns an int representation of the 4 bytes
at current position in the stream. |
int[] |
readIntArray()
Returns a int array representation of the entire stream. |
int[] |
readIntArray(int size)
Returns a int array representation of the bytes
at the current position in the stream. |
short |
readShort()
Returns a short representation of the 2 bytes at
current position in the stream. |
short[] |
readShortArray()
Returns a short array representation of the entire stream. |
short[] |
readShortArray(int size)
Returns a short array representation of the bytes
at the current position in the stream. |
java.lang.String |
readString()
Returns a String representation of the entire stream. |
java.lang.String |
readString(int size)
Returns a String representation of the bytes
at the current position in the stream. |
void |
setBigEndian(boolean bigEndian)
Sets big endian or little endian mode. |
int |
size()
Returns total number of bytes entered in the stream. |
void |
skipBytes(int size)
Skip size bytes from the current position in the stream. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
APDUDataInputStream
public APDUDataInputStream(byte[] data)
- Constructs an
APDUDataInputStream object.
This stream lets an application read primitive Java data types
from an underlying APDU data (passed as an array of bytes).
- Parameters:
data - array on which is applied the stream
APDUDataInputStream
public APDUDataInputStream(ResponseAPDU response)
- Constructs an
APDUDataInputStream object.
This stream lets an application read primitive Java data types
from an underlying APDU data (passed as an APDU response).
- Parameters:
response - APDU response on which data is applied the stream
size
public int size()
- Returns total number of
bytes entered in the stream.
- Returns:
- the size of data entered
available
public int available()
- Returns the number of remaining bytes available in the stream.
- Returns:
- the remaining bytes available
setBigEndian
public void setBigEndian(boolean bigEndian)
- Sets big endian or little endian mode.
- Parameters:
bigEndian
- if true, big endian mode is set (default mose)
if false, little endian mode is set
readBoolean
public boolean readBoolean()
- Returns a boolean representation of the byte at current position
in the stream.
- Returns:
false if the value of the current byte
is set to 0, true else.
readBooleanArray
public boolean[] readBooleanArray()
- Returns a
boolean array representation of the
entire stream.
- Returns:
- value of the entire stream
readBooleanArray
public boolean[] readBooleanArray(int size)
- Returns a
boolean array representation of the bytes
at the current position in the stream.
- Parameters:
size - size of the resulting boolean array- Returns:
- value of the
size booleans
at the current position in the stream
readByte
public byte readByte()
- Returns the
byte at current position in the stream.
- Returns:
- value of the
byte at current position in
the stream
readByteArray
public byte[] readByteArray()
- Returns a
byte array representation of the entire stream.
- Returns:
- value of the entire stream
readByteArray
public byte[] readByteArray(int size)
- Returns a
byte array representation of the bytes at the
current position in the stream.
- Parameters:
size - size (in bytes) of the resulting byte array- Returns:
- value of the
size bytes at the
current position in the stream
readShort
public short readShort()
- Returns a
short representation of the 2 bytes at
current position in the stream.
- Returns:
- value of the
short at current position
in the stream
readShortArray
public short[] readShortArray()
- Returns a
short array representation of the entire stream.
- Returns:
- value of the entire stream
readShortArray
public short[] readShortArray(int size)
- Returns a
short array representation of the bytes
at the current position in the stream.
- Parameters:
size - size (in shorts) of the resulting byte array- Returns:
- value of the
size shorts
at the current position in the stream
readInt
public int readInt()
- Returns an
int representation of the 4 bytes
at current position in the stream.
- Returns:
- value of the
int at current position in the stream
readIntArray
public int[] readIntArray()
- Returns a
int array representation of the entire stream.
- Returns:
- value of the entire stream
readIntArray
public int[] readIntArray(int size)
- Returns a
int array representation of the bytes
at the current position in the stream.
- Parameters:
size - size (in ints) of the resulting byte array- Returns:
- value of the
size ints at the current
position in the stream
readString
public java.lang.String readString()
- Returns a
String representation of the entire stream.
- Returns:
- value of the entire stream
readString
public java.lang.String readString(int size)
- Returns a
String representation of the bytes
at the current position in the stream.
- Parameters:
size - size (in characters) of the resulting String- Returns:
- value of the
size characters at the
current position in the stream
skipBytes
public void skipBytes(int size)
- Skip
size bytes from the current position in the stream.
- Parameters:
size - number of bytes to skip- Returns:
- void
|