Package org.nfctools.mf.classic

Examples of org.nfctools.mf.classic.MfClassicAccess


    }
    return baos.toByteArray();
  }

  private void readBlockData(KeyValue keyValue, ByteArrayOutputStream baos, int sectorId) throws IOException {
    MfClassicAccess access = new MfClassicAccess(keyValue, sectorId, 0,
        memoryLayout.getDataBlocksPerSector(sectorId));
    MfBlock[] blocks = readerWriter.readBlock(access);
    for (MfBlock block : blocks) {
      baos.write(block.getData());
    }
View Full Code Here


      for (int slot = firstSlot; slot <= lastSlot; slot++) {
        int sectorId = mad.getSectorIdForSlot(slot);
        for (int blockId = 0; blockId < memoryLayout.getDataBlocksPerSector(sectorId); blockId++) {

          MfClassicAccess access = new MfClassicAccess(keyValue, sectorId, blockId);

          byte[] buffer = new byte[MfConstants.BYTES_PER_BLOCK];
          if (bais.available() > 0)
            bais.read(buffer);
View Full Code Here

  @Override
  public void updateTrailer(KeyValue keyValue, TrailerBlock trailerBlock) throws IOException {
    for (int slot = firstSlot; slot <= lastSlot; slot++) {
      int sectorId = mad.getSectorIdForSlot(slot);
      MfClassicAccess access = new MfClassicAccess(keyValue, sectorId,
          memoryLayout.getTrailerBlockNumberForSector(sectorId));

      readerWriter.writeBlock(access, trailerBlock);
    }
    this.trailerBlock = trailerBlock;
View Full Code Here

  @Override
  public TrailerBlock readTrailer(KeyValue keyValue) throws IOException {
    if (trailerBlock == null) {
      for (int slot = firstSlot; slot <= lastSlot; slot++) {
        int sectorId = mad.getSectorIdForSlot(slot);
        MfClassicAccess access = new MfClassicAccess(keyValue, sectorId,
            memoryLayout.getTrailerBlockNumberForSector(sectorId));

        TrailerBlock block = (TrailerBlock)readerWriter.readBlock(access)[0];
        if (trailerBlock == null) {
          trailerBlock = block;
View Full Code Here

  }

  @Override
  public boolean hasApplicationDirectory() throws IOException {
    try {
      MfClassicAccess access = new MfClassicAccess(MfClassicConstants.MAD_KEY, 0,
          memoryLayout.getTrailerBlockNumberForSector(0));
      TrailerBlock madTrailer = (TrailerBlock)readBlock(access)[0];
      return ((madTrailer.getGeneralPurposeByte() & MadConstants.GPB_MAD_AVAILABLE) != 0);
    }
    catch (MfLoginException e) {
View Full Code Here

  }

  private MfBlock[] readManuBlockWithMultiKeys(KeyValue... keyValues) throws IOException {
    for (KeyValue keyValue : keyValues) {
      try {
        MfClassicAccess access = new MfClassicAccess(keyValue, 0, 0);
        MfBlock[] block = readBlock(access);
        return block;
      }
      catch (MfLoginException e) {
      }
View Full Code Here

TOP

Related Classes of org.nfctools.mf.classic.MfClassicAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.