@Test public void testIsFormattedWritable() throws Exception { ApplicationDirectory applicationDirectory = ReaderWriterCreator.createReadWriter("mfstd1k_ndef.txt", MemoryLayout.CLASSIC_1K).getApplicationDirectory(); assertTrue(ClassicHandler.isFormattedWritable(applicationDirectory.openApplication(MfConstants.NDEF_APP_ID), MfClassicConstants.TRANSPORT_KEY)); ApplicationDirectory applicationDirectory2 = ReaderWriterCreator.createReadWriter("mfstd4k_ndef.txt", MemoryLayout.CLASSIC_4K).getApplicationDirectory(); assertTrue(ClassicHandler.isFormattedWritable(applicationDirectory2.openApplication(MfConstants.NDEF_APP_ID), MfClassicConstants.NDEF_KEY)); }
public static boolean isFormattedWritable(Application application, KeyValue keyValue) throws IOException { try { TrailerBlock trailerBlock = application.readTrailer(keyValue); for (int dataArea = 0; dataArea < 3; dataArea++) { if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea)) return false; } if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0) return false; return true; } catch (MfLoginException e) { return false; } }
ClassicHandler { public static boolean isFormattedWritable(Application application, KeyValue keyValue) throws IOException { try { TrailerBlock trailerBlock = application.readTrailer(keyValue); for (int dataArea = 0; dataArea < 3; dataArea++) { if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea)) return false; } if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0) return false; return true; } catch (MfLoginException e) { return false; } } }
ClassicHandler { public static boolean isFormattedWritable(Application application, KeyValue keyValue) throws IOException { try { TrailerBlock trailerBlock = application.readTrailer(keyValue); for (int dataArea = 0; dataArea < 3; dataArea++) { if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea)) return false; } if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0) return false; return true; } catch (MfLoginException e) { return false; } }  }
ClassicHandler { public static boolean isFormattedWritable(Application application, KeyValue keyValue) throws IOException { try { TrailerBlock trailerBlock = application.readTrailer(keyValue); for (int dataArea = 0; dataArea < 3; dataArea++) { if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea)) return false; } if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0) 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 isFormattedWritable(Application application, KeyValue keyValue) throws IOException { try { TrailerBlock trailerBlock = application.readTrailer(keyValue); for (int dataArea = 0; dataArea < 3; dataArea++) { if (!trailerBlock.canWriteDataBlock(keyValue.getKey(), dataArea)) return false; } if (NfcUtils.getLeastSignificantNibble(trailerBlock.getGeneralPurposeByte()) != 0) return false; return true; } catch (MfLoginException e) { return false; } }  static boolean isBlank(MfClassicReaderWriter readerWriter); static boolean isFormattedWritable(Application application, KeyValue keyValue); static TrailerBlock createReadWriteDataTrailerBlock();  }