@Test public void readRecordRespPars_getRecords_twoRecords() { ReadRecordsCmdBuild readRecordsCmdBuild = new ReadRecordsCmdBuild( PoClass.ISO, SFI1, FIRST_REC1, ReadMode.MULTIPLE_RECORD, EXPECTED_LENGTH2); ReadRecordsRespPars readRecordRespPars = readRecordsCmdBuild.createResponseParser( new ApduResponse(ByteArrayUtil.fromHex(APDU_TWO_RECORDS), null)); readRecordRespPars.checkStatus(); SortedMap<Integer, byte[]> records = readRecordRespPars.getRecords(); assertThat(records.size()).isEqualTo(2); assertThat(records.get(FIRST_REC1)).isEqualTo(ByteArrayUtil.fromHex(REC1)); assertThat(records.get(FIRST_REC1 + 1)).isEqualTo(ByteArrayUtil.fromHex(REC2)); }
public SortedMap<Integer, byte[]> getRecords() { SortedMap<Integer, byte[]> records = new TreeMap<Integer, byte[]>(); if (((ReadRecordsCmdBuild) builder).getReadMode() == ReadRecordsCmdBuild.ReadMode.ONE_RECORD) { records.put(((ReadRecordsCmdBuild) builder).getFirstRecordNumber(), response.getDataOut()); } else { byte[] apdu = response.getDataOut(); int apduLen = apdu.length; int index = 0; while (apduLen > 0) { byte recordNb = apdu[index++]; byte len = apdu[index++]; records.put((int) recordNb, Arrays.copyOfRange(apdu, index, index + len)); index = index + len; apduLen = apduLen - 2 - len; } } return records; }
ReadRecordsRespPars extends AbstractPoResponseParser { public SortedMap<Integer, byte[]> getRecords() { SortedMap<Integer, byte[]> records = new TreeMap<Integer, byte[]>(); if (((ReadRecordsCmdBuild) builder).getReadMode() == ReadRecordsCmdBuild.ReadMode.ONE_RECORD) { records.put(((ReadRecordsCmdBuild) builder).getFirstRecordNumber(), response.getDataOut()); } else { byte[] apdu = response.getDataOut(); int apduLen = apdu.length; int index = 0; while (apduLen > 0) { byte recordNb = apdu[index++]; byte len = apdu[index++]; records.put((int) recordNb, Arrays.copyOfRange(apdu, index, index + len)); index = index + len; apduLen = apduLen - 2 - len; } } return records; } }
ReadRecordsRespPars extends AbstractPoResponseParser { public SortedMap<Integer, byte[]> getRecords() { SortedMap<Integer, byte[]> records = new TreeMap<Integer, byte[]>(); if (((ReadRecordsCmdBuild) builder).getReadMode() == ReadRecordsCmdBuild.ReadMode.ONE_RECORD) { records.put(((ReadRecordsCmdBuild) builder).getFirstRecordNumber(), response.getDataOut()); } else { byte[] apdu = response.getDataOut(); int apduLen = apdu.length; int index = 0; while (apduLen > 0) { byte recordNb = apdu[index++]; byte len = apdu[index++]; records.put((int) recordNb, Arrays.copyOfRange(apdu, index, index + len)); index = index + len; apduLen = apduLen - 2 - len; } } return records; } ReadRecordsRespPars(ApduResponse apduResponse, ReadRecordsCmdBuild builder); }
ReadRecordsRespPars extends AbstractPoResponseParser { public SortedMap<Integer, byte[]> getRecords() { SortedMap<Integer, byte[]> records = new TreeMap<Integer, byte[]>(); if (((ReadRecordsCmdBuild) builder).getReadMode() == ReadRecordsCmdBuild.ReadMode.ONE_RECORD) { records.put(((ReadRecordsCmdBuild) builder).getFirstRecordNumber(), response.getDataOut()); } else { byte[] apdu = response.getDataOut(); int apduLen = apdu.length; int index = 0; while (apduLen > 0) { byte recordNb = apdu[index++]; byte len = apdu[index++]; records.put((int) recordNb, Arrays.copyOfRange(apdu, index, index + len)); index = index + len; apduLen = apduLen - 2 - len; } } return records; } ReadRecordsRespPars(ApduResponse apduResponse, ReadRecordsCmdBuild builder); SortedMap<Integer, byte[]> getRecords(); }
ReadRecordsRespPars extends AbstractPoResponseParser { public SortedMap<Integer, byte[]> getRecords() { SortedMap<Integer, byte[]> records = new TreeMap<Integer, byte[]>(); if (((ReadRecordsCmdBuild) builder).getReadMode() == ReadRecordsCmdBuild.ReadMode.ONE_RECORD) { records.put(((ReadRecordsCmdBuild) builder).getFirstRecordNumber(), response.getDataOut()); } else { byte[] apdu = response.getDataOut(); int apduLen = apdu.length; int index = 0; while (apduLen > 0) { byte recordNb = apdu[index++]; byte len = apdu[index++]; records.put((int) recordNb, Arrays.copyOfRange(apdu, index, index + len)); index = index + len; apduLen = apduLen - 2 - len; } } return records; } ReadRecordsRespPars(ApduResponse apduResponse, ReadRecordsCmdBuild builder); SortedMap<Integer, byte[]> getRecords();  }