@Test public void testIsBlank() throws Exception { assertTrue(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd1k_blank.txt", MemoryLayout.CLASSIC_1K))); assertTrue(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd4k_blank.txt", MemoryLayout.CLASSIC_4K))); assertFalse(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd1k_ndef.txt", MemoryLayout.CLASSIC_1K))); assertFalse(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd4k_ndef.txt", MemoryLayout.CLASSIC_4K))); }
public static boolean isBlank(MfClassicReaderWriter readerWriter) throws IOException { try { MemoryLayout memoryLayout = readerWriter.getMemoryLayout(); for (int sector = 0; sector < memoryLayout.getSectors(); sector++) { TrailerBlock trailerBlock = readTrailerBlock(readerWriter, sector, MfClassicConstants.TRANSPORT_KEY); if (!Arrays.equals(MfConstants.TRANSPORT_ACCESS_CONDITIONS, trailerBlock.getAccessConditions())) return false; if (trailerBlock.getGeneralPurposeByte() != MfConstants.TRANSPORT_GPB) return false; } return true; } catch (MfLoginException e) { return false; } }
ClassicHandler { public static boolean isBlank(MfClassicReaderWriter readerWriter) throws IOException { try { MemoryLayout memoryLayout = readerWriter.getMemoryLayout(); for (int sector = 0; sector < memoryLayout.getSectors(); sector++) { TrailerBlock trailerBlock = readTrailerBlock(readerWriter, sector, MfClassicConstants.TRANSPORT_KEY); if (!Arrays.equals(MfConstants.TRANSPORT_ACCESS_CONDITIONS, trailerBlock.getAccessConditions())) return false; if (trailerBlock.getGeneralPurposeByte() != MfConstants.TRANSPORT_GPB) return false; } return true; } catch (MfLoginException e) { return false; } } }
ClassicHandler { public static boolean isBlank(MfClassicReaderWriter readerWriter) throws IOException { try { MemoryLayout memoryLayout = readerWriter.getMemoryLayout(); for (int sector = 0; sector < memoryLayout.getSectors(); sector++) { TrailerBlock trailerBlock = readTrailerBlock(readerWriter, sector, MfClassicConstants.TRANSPORT_KEY); if (!Arrays.equals(MfConstants.TRANSPORT_ACCESS_CONDITIONS, trailerBlock.getAccessConditions())) return false; if (trailerBlock.getGeneralPurposeByte() != MfConstants.TRANSPORT_GPB) return false; } return true; } catch (MfLoginException e) { return false; } }  }
ClassicHandler { public static boolean isBlank(MfClassicReaderWriter readerWriter) throws IOException { try { MemoryLayout memoryLayout = readerWriter.getMemoryLayout(); for (int sector = 0; sector < memoryLayout.getSectors(); sector++) { TrailerBlock trailerBlock = readTrailerBlock(readerWriter, sector, MfClassicConstants.TRANSPORT_KEY); if (!Arrays.equals(MfConstants.TRANSPORT_ACCESS_CONDITIONS, trailerBlock.getAccessConditions())) return false; if (trailerBlock.getGeneralPurposeByte() != MfConstants.TRANSPORT_GPB) return false; } return true; } catch (MfLoginException e) { return false; } }  static boolean isBlank(MfClassicReaderWriter readerWriter); static boolean isFormattedWritable(Application application, KeyValue keyValue); static TrailerBlock createReadWriteDataTrailerBlock(); }
ClassicHandler { public static boolean isBlank(MfClassicReaderWriter readerWriter) throws IOException { try { MemoryLayout memoryLayout = readerWriter.getMemoryLayout(); for (int sector = 0; sector < memoryLayout.getSectors(); sector++) { TrailerBlock trailerBlock = readTrailerBlock(readerWriter, sector, MfClassicConstants.TRANSPORT_KEY); if (!Arrays.equals(MfConstants.TRANSPORT_ACCESS_CONDITIONS, trailerBlock.getAccessConditions())) return false; if (trailerBlock.getGeneralPurposeByte() != MfConstants.TRANSPORT_GPB) return false; } return true; } catch (MfLoginException e) { return false; } }  static boolean isBlank(MfClassicReaderWriter readerWriter); static boolean isFormattedWritable(Application application, KeyValue keyValue); static TrailerBlock createReadWriteDataTrailerBlock();  }