Showing posts with label jbbp. Show all posts
Showing posts with label jbbp. Show all posts

Sunday, September 3, 2017

JBBP 1.3.0

Java Binary Block Parser 1.3.0 is out and accessible in the Maven Central. The Main feature of the version - to generate Java class sources from JBBP scripts, the feature allows to use the framework for more or less high-load systems. The Library still has size less than 200 kBt but since the version it needs Java 1.6+ (minimal Android version is still 2.0). Also there are published two plugins for Maven and Gradle which allow to generate Java classes from JBBP scripts on fly during project build phase.
Also of course minor refactoring and bugfixing.
p.s.
The Library is used by Orange for its Datavenue Live Objects service

Sunday, August 7, 2016

added one more example for JBBP

Added one more example for JBBP to show how to add a custom type into parser, as example I have written a parser for three byte non-signed integer value with "int24" as name of the type . The Example formed as a JUnit test and published in the GitHub.

Tuesday, June 9, 2015

JBBP 1.2.0 is out

JBBP 1.2.0 (most comfortable way to work with binary data in Java) has been published in Maven central
https://github.com/raydac/java-binary-block-parser

Wednesday, February 4, 2015

New version of Java Binary Block Parser (JBBP) 1.1.0 is out

The New version of JBBP 1.1.0 is out and accessible in the maven central, now it supports not only parsing of binary data and mapping them to classes but also and back operation - packing binary data blocks from mapped classes and even printing of mapped class  description, take a look at example


class Flags {
      @Bin(outOrder = 1, name = "f1", type = BinType.BIT, outBitNumber = JBBPBitNumber.BITS_1, comment = "It's flag one") byte flag1;
      @Bin(outOrder = 2, name = "f2", type = BinType.BIT, outBitNumber = JBBPBitNumber.BITS_2, comment = "It's second flag") byte flag2;
      @Bin(outOrder = 3, name = "f3", type = BinType.BIT, outBitNumber = JBBPBitNumber.BITS_1, comment = "It's 3th flag") byte flag3;
      @Bin(outOrder = 4, name = "f4", type = BinType.BIT, outBitNumber = JBBPBitNumber.BITS_4, comment = "It's 4th flag") byte flag4;
    }
    final int data = 0b10101010;
    Flags parsed = JBBPParser.prepare("bit:1 f1; bit:2 f2; bit:1 f3; bit:4 f4;", JBBPBitOrder.MSB0).parse(new byte[]{(byte)data}).mapTo(Flags.class);
    System.out.println(new JBBPTextWriter().Bin(parsed).Close().toString());
    assertEquals(data, JBBPOut.BeginBin(JBBPBitOrder.MSB0).Bin(parsed).End().toByteArray()[0] & 0xFF);
the code will parse the byte, then print its values

;--------------------------------------------------------------------------------
; START : Flags
;--------------------------------------------------------------------------------
    01; f1, It's flag one
    02; f2, It's second flag
    00; f3, It's 3th flag
    05; f4, It's 4th flag
;--------------------------------------------------------------------------------
; END : Flags
;--------------------------------------------------------------------------------
and again will pack parsed data into byte

Sunday, August 10, 2014

Java Binary data parsing and packing

 I have published "yet another Java framework to parse and pack binary blocks"  (because I am too lazy to write tons of lines for different cases), I wanted some small compatible with JavaSE and Android solution so that meet the JBBP (Java Binary Block Parser).