Android Open Source - bankomatinfos B E R T L V






From Project

Back to project page bankomatinfos.

License

The source code is released under:

GNU General Public License

If you think the Android project bankomatinfos listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2010 sasc/*w  w w . j a  va2s .  c  o m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package at.zweng.bankomatinfos.iso7816emv;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import static at.zweng.bankomatinfos.util.Utils.*;

/**
 * Source https://code.google.com/p/javaemvreader/
 * 
 * @author sasc
 */
public class BERTLV {

  private EmvTag tag;
  private byte[] rawEncodedLengthBytes;
  private byte[] valueBytes;
  private int length;

  /**
   * 
   * @param tag
   * @param length
   *            contains the number of value bytes (parsed from the
   *            rawEncodedLengthBytes)
   * @param rawLengthBytes
   *            the raw encoded length bytes
   * @param valueBytes
   */
  public BERTLV(EmvTag tag, int length, byte[] rawEncodedLengthBytes,
      byte[] valueBytes) {
    if (length != valueBytes.length) {
      // Assert
      throw new IllegalArgumentException("length != bytes.length");
    }
    this.tag = tag;
    this.rawEncodedLengthBytes = rawEncodedLengthBytes;
    this.valueBytes = valueBytes;
    this.length = length;
  }

  public byte[] getTagBytes() {
    return tag.getTagBytes();
  }

  public byte[] getRawEncodedLengthBytes() {
    return rawEncodedLengthBytes;
  }

  public byte[] getValueBytes() {
    return valueBytes;
  }

  public ByteArrayInputStream getValueStream() {
    return new ByteArrayInputStream(valueBytes);
  }

  public byte[] toBERTLVByteArray() {
    byte[] tagBytes = tag.getTagBytes();
    ByteArrayOutputStream stream = new ByteArrayOutputStream(
        tagBytes.length + rawEncodedLengthBytes.length
            + valueBytes.length);
    stream.write(tagBytes, 0, tagBytes.length);
    stream.write(rawEncodedLengthBytes, 0, rawEncodedLengthBytes.length);
    stream.write(valueBytes, 0, valueBytes.length);
    return stream.toByteArray();
  }

  @Override
  public String toString() {
    return "BER-TLV[" + bytesToHex(getTagBytes()) + ", "
        + int2Hex(length) + " (raw "
        + bytesToHex(rawEncodedLengthBytes) + ")" + ", "
        + bytesToHex(valueBytes) + "]";
  }

  public EmvTag getTag() {
    return tag;
  }

  public int getLength() {
    return length;
  }
}




Java Source Code List

at.zweng.bankomatinfos.AppController.java
at.zweng.bankomatinfos.exceptions.NoSmartCardException.java
at.zweng.bankomatinfos.exceptions.TlvParsingException.java
at.zweng.bankomatinfos.iso7816emv.BERTLV.java
at.zweng.bankomatinfos.iso7816emv.ByteArrayWrapper.java
at.zweng.bankomatinfos.iso7816emv.CPLC.java
at.zweng.bankomatinfos.iso7816emv.EMVTags.java
at.zweng.bankomatinfos.iso7816emv.EmvTag.java
at.zweng.bankomatinfos.iso7816emv.EmvUtils.java
at.zweng.bankomatinfos.iso7816emv.GPTags.java
at.zweng.bankomatinfos.iso7816emv.Iso3166CountryCodes.java
at.zweng.bankomatinfos.iso7816emv.Iso4217CurrencyCodes.java
at.zweng.bankomatinfos.iso7816emv.NfcBankomatCardReader.java
at.zweng.bankomatinfos.iso7816emv.TagAndValue.java
at.zweng.bankomatinfos.iso7816emv.TagImpl.java
at.zweng.bankomatinfos.iso7816emv.TagType.java
at.zweng.bankomatinfos.iso7816emv.TagValueType.java
at.zweng.bankomatinfos.model.AbstractTransactionLogEntry.java
at.zweng.bankomatinfos.model.CardInfo.java
at.zweng.bankomatinfos.model.EmvTransactionLogEntry.java
at.zweng.bankomatinfos.model.InfoKeyValuePair.java
at.zweng.bankomatinfos.model.QuickTransactionLogEntry.java
at.zweng.bankomatinfos.ui.AboutDialogFragment.java
at.zweng.bankomatinfos.ui.ChangelogDialogFragment.java
at.zweng.bankomatinfos.ui.ListAdapterEmvTransactions.java
at.zweng.bankomatinfos.ui.ListAdapterInfos.java
at.zweng.bankomatinfos.ui.ListAdapterQuickTransactions.java
at.zweng.bankomatinfos.ui.MainActivity.java
at.zweng.bankomatinfos.ui.NfcDisabledActivity.java
at.zweng.bankomatinfos.ui.ResultActivity.java
at.zweng.bankomatinfos.ui.ResultEmvTxListFragment.java
at.zweng.bankomatinfos.ui.ResultInfosListFragment.java
at.zweng.bankomatinfos.ui.ResultLogFragment.java
at.zweng.bankomatinfos.ui.ResultQuickTxListFragment.java
at.zweng.bankomatinfos.ui.SettingsActivity.java
at.zweng.bankomatinfos.util.ChangeLog.java
at.zweng.bankomatinfos.util.CustomAlertDialog.java
at.zweng.bankomatinfos.util.Utils.java