The binary package consists of classes for reading and writing binary location reference data as a service. The OpenLR encoder may use this package to create a binary representation of a location reference. The OpenLR decoder may use this package to receive and decode binary location reference data. This package implements the versions 2 and 3 of the binary data format as described in the OpenLR white paper.
The default version is -- 3 --.
Version 2 of the format is not applicable for point or area locations. In addition it uses an old format for defining offsets which might lead to inaccurate locations. The lastest version 3 supports area, point and line locations and it makes use of the better offsets implementation (using relative values).
Each piece of information is encapsulated in an own class. The application needs to set the relevant fields and afterwards the data can be written to a BitstreamOuput. After reading data from a BitstreamInput the data can also be directly accessed from the corresponding objects. The applications needs to ensure that the order of data in the input/output stream is correct.
The bitstream implementation uses a Big Endian alignment and can store and read data with a maximum size of 32 bits at a time. The total size of a bitstream is not limited. The implementation offers to read from and write to byte arrays and files.
The implementation also offers logging functionality (log4j) which can be configured using the logging.properties file provided in the package or you need to put a file name log4j.properties in your classpath.