use of es.gob.jmulticard.apdu.iso7816four.ReadRecordApduCommand in project jmulticard by ctt-gob-es.
the class Iso7816FourCard method readAllRecords.
/**
* Lee todos los registros del binario actualmente seleccionado.
* @return Lista de registros leidos del binario actualmente seleccionado.
* @throws ApduConnectionException Si hay problemas en el envío de la APDU.
* @throws Iso7816FourCardException SI ocurren problemas durante la lectura de los registros.
*/
public List<byte[]> readAllRecords() throws ApduConnectionException, Iso7816FourCardException {
final List<byte[]> ret = new ArrayList<>();
StatusWord readedResponseSw;
final CommandApdu readRecordApduCommand = new ReadRecordApduCommand(getCla());
do {
final ResponseApdu readedResponse = sendArbitraryApdu(readRecordApduCommand);
readedResponseSw = readedResponse.getStatusWord();
if (!readedResponse.isOk() && !ReadRecordApduCommand.RECORD_NOT_FOUND.equals(readedResponseSw)) {
throw new Iso7816FourCardException(// $NON-NLS-1$
"Error en la lectura de registro", // $NON-NLS-1$
readedResponseSw);
}
ret.add(readedResponse.getData());
} while (!ReadRecordApduCommand.RECORD_NOT_FOUND.equals(readedResponseSw));
return ret;
}
Aggregations