Binary file parser java


It contains raw uninterpreted Java code that is meant to be included at the top of the generated parser code. This will generally binary file parser java package declarations, import statements, and non-public class definitions. The concanenation of all text and CDATA in document order will define the text of the Java code which will be inserted at the top of the generated file, completely unmodified.

This text is used to define the types of each of the nonterminal symbols defined inside a rules tag. A nonterminal's type may either be simple or functional. A simple type is used for nonterminals that take no parameters and return a value. A functional type is for nonterminals that take 1 or more parameters and return a value.

The type of a rule in the types tag must match with the definition of the tag itself in the rules tag. That is, if there is a nonterminal in the rules tag that takes 3 formal parameters, then the matching entry in the types tag must have a functional type with 3 parameter types listed. The syntax of the text in the types tag is as follows:. This tag defines the "grammar" of the binary data format, and contains definitions of nonterminal rules for parsing it.

The rules has one required attribute, which is the name of the top-level rule that will begin the parsing. The top-level rule MUST have a simple type i. This tag defines the byte-ordering binary file parser java be used for parsing multi-byte values.

The two options are big-endian and little-endian. In a big-endian byte ordering, a multi-byte value will use the first byte read from the stream as its most-significant byte.

In a little-endian byte ordering, a multi-byte value will use the first byte read from the stream as its least-significant byte. This tag defines the byte ordering through its single required attribute, valuewhich can have the value "big" or "little". This tag does not allow any contents. Much binary file parser java the byte-order tag, this tag defines the order in which bits are used when reading a multi-bit value.

This tag only affects the result of the bits primitive value item. If the bit ordering is set to big-endian, then the first bit read will be the most significant bit used in the result. If binary file parser java bit ordering is little-endian, then the first bit binary file parser java will be the least significant bit used in the result. To be very clear, this tag only affects the order in which bits are packaged into a multi-bit value, it DOES NOT affect the order binary file parser java which bits are read binary file parser java the stream.

The order in which bits are read from the binary file parser java always proceeds within a byte by progressing from less-significant bits to more-significant bits. For example, if you had the two bytes [, ] in the stream, then the next 16 bits in order would be: This tag defines the bit ordering through its single required attribute, valuewhich can have the value "big" or "little".

The syntax of the text in the types tag is as follows: Details about the usage of the various parts of the rules tag can be found here.