If you want to access to binary data produced with C or C++ using Java, ByteDataAccess helps to read and write such C-oriented binary data. In principle the data are available in Java in a byte-Array. This byte may be filled and/or write out with the content of a binary file or with the payload of an UDP or TCP stream. The class ByteDataAcess contains base functionality to access to the data and read they in int-, float-, String- and so on -format. A user class that extents ByteDataAccess can program the access to user-level-data.
This shown translation from struct in Headerfiles to Java code produces a user class extended ByteDataAccess to access to data in Java that are defined in the header's struct.
The baseclass org.vishia.byteDataAccess is part of this example.
The example contains the following files:
del_results.bat: delete result files
genJavaFromHeaders.bat: Runs the ZBNF parser and XSLT, produces the srcJava_gen-Folder.
makeJar_TestByteDataFromHeader.bat: Comiles the java sources including the generating source, builds the TestByteDataFromHeader.jar
runTest.bat: Runs the comiled Java example, the files exampleData.bin and exampleDataLEndian.bin are written.
Mystruct.h: The structure of the data described in C language (It is the structure in the generated bin files).
srcJava: Folder with an example java file in org.vishia.byteData.test and the standard org.vishia.byteData package
TestByteDataFromHeader.manifest: to build the jar-File.
readme_ByteDataAccessJava.html: this readme
The following files are produces running the batches:
srcJava_gen: Folder with generated java file.
TestByteDataFromHeader.jar: Executable for Java
exampleData.bin: Produces data.
exampleDataLEndian.bin: The same produce data, but stored in little endian.
tmp temporary files while running ZBNF, XSLT to generate Java code. You
may visit this temporaries to learn about the immaging of parser.
The following files are references for the generated files (compared after software changes).
srcJava_gen.reference: The Java file which should be generate.