Package org.nfctools.mf.tlv

Examples of org.nfctools.mf.tlv.TypeLengthValueReader


        Application application = getApplication();
        // TODO create TagInputStream for better performance
        byte[] tlvWrappedNdefMessage = application.read(new KeyValue(Key.A, MfConstants.NDEF_KEY));
        if (log.isDebugEnabled())
          log.debug(NfcUtils.convertBinToASCII(tlvWrappedNdefMessage));
        TypeLengthValueReader reader = new TypeLengthValueReader(
            new ByteArrayInputStream(tlvWrappedNdefMessage));
        convertRecords(reader);
        return lastReadRecords;
      }
      catch (IOException e) {
View Full Code Here


      System.out.println();
    }
  }

  public static void outputNdefMessage(MfUlReaderWriter readerWriter, MemoryLayout memoryLayout) {
    TypeLengthValueReader reader = new TypeLengthValueReader(new TagInputStream(memoryLayout, readerWriter));

    while (reader.hasNext()) {
      Tlv tlv = reader.next();
      if (tlv instanceof NdefMessageTlv) {
        NdefMessage ndefMessage = decoder.decode(((NdefMessageTlv)tlv).getNdefMessage());
        for (Record record : decoder.decodeToRecords(ndefMessage)) {
          System.out.println(record);
        }
View Full Code Here

    assertFormatted();
    if (lastReadRecords != null) {
      return lastReadRecords;
    }
    else {
      TypeLengthValueReader reader = new TypeLengthValueReader(new TagInputStream(memoryLayout, readerWriter));
      convertRecords(reader);
      return lastReadRecords;
    }
  }
View Full Code Here

      byte[] tlvWrappedNdefMessage = application.read(new KeyValue(Key.A, MfConstants.NDEF_KEY));

      if (log.isDebugEnabled())
        log.debug(NfcUtils.convertBinToASCII(tlvWrappedNdefMessage));

      TypeLengthValueReader lengthValueReader = new TypeLengthValueReader(new ByteArrayInputStream(
          tlvWrappedNdefMessage));

      List<Record> records = new ArrayList<Record>();

      while (lengthValueReader.hasNext()) {
        Tlv tlv = lengthValueReader.next();
        if (tlv instanceof NdefMessageTlv) {
          NdefMessage ndefMessage = ndefMessageDecoder.decode(((NdefMessageTlv)tlv).getNdefMessage());
          for (Record record : ndefMessageDecoder.decodeToRecords(ndefMessage)) {
            records.add(record);
          }
View Full Code Here

TOP

Related Classes of org.nfctools.mf.tlv.TypeLengthValueReader

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.