Skip to content
BER-TLV parser and builder
Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github/workflows Update maven.yml Sep 10, 2019
.mvn/wrapper
concourse Added concourse pipeline for testing against java 8 and 7 May 15, 2017
src #10 Fixed Last tag from a hex string is sometimes missing after parsing Sep 10, 2019
.gitignore
.travis.yml Update .travis.yml Sep 10, 2019
LICENSE.txt Added a LICENSE May 12, 2017
README.md Added circleci badge Nov 5, 2018
mvnw
mvnw.cmd Added maven wrapper Nov 5, 2018
pom.xml [maven-release-plugin] prepare for next development iteration Sep 10, 2019

README.md

maven Build Status CircleCI

BER-TLV parser and builder

BerTlv is a java library for parsing and building BER TLV encoded data.

Features

  • supported types: amount, date, time, text, BCD, bytes
  • thread safe (provides immutable container BerTlv)
  • production ready (uses in several projects)
  • lightweight (no external dependencies)

Setup with dependency managers

Maven

<dependency>
  <groupId>com.payneteasy</groupId>
  <artifactId>ber-tlv</artifactId>
  <version>$VERSION</version>
</dependency>

Gradle

compile 'com.payneteasy:ber-tlv:$VERSION'

How to parse

byte[] bytes = HexUtil.parseHex("50045649534157131000023100000033D44122011003400000481F");

BerTlvParser parser = new BerTlvParser(LOG);
BerTlvs tlvs = parser.parse(bytes, 0, bytes.length);
  
BerTlvLogger.log("    ", tlvs, LOG);

How to build

byte[] bytes =  new BerTlvBuilder()
                .addHex(new BerTag(0x50), "56495341")
                .addHex(new BerTag(0x57), "1000023100000033D44122011003400000481F")
                .buildArray();

License

The BerTlv framework is licensed under the Apache License 2.0

You can’t perform that action at this time.