File tree 5 files changed +132
-0
lines changed
5 files changed +132
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Java CI with Maven
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ pull_request : {}
8
+
9
+ jobs :
10
+ build :
11
+
12
+ runs-on : ubuntu-latest
13
+
14
+ strategy :
15
+ fail-fast : false
16
+ matrix :
17
+ ks-java-runtime-lib-ref :
18
+ - ' ' # the default branch
19
+ - ' build-for-java-7'
20
+ java-version :
21
+ - ' 8'
22
+ - ' 11'
23
+ - ' 17'
24
+
25
+ steps :
26
+ - name : Checkout the KS runtime lib for Java
27
+ uses : actions/checkout@v3
28
+ with :
29
+ repository : ' kaitai-io/kaitai_struct_java_runtime'
30
+ ref : ${{ matrix.ks-java-runtime-lib-ref }}
31
+ - name : Set up JDK
32
+ uses : actions/setup-java@v3
33
+ with :
34
+ java-version : ${{ matrix.java-version }}
35
+ distribution : ' temurin'
36
+ - name : Build with Maven
37
+ run : mvn -B package --file pom.xml
38
+ - uses : actions/upload-artifact@v3
39
+ with :
40
+ name : ks-runtime-built-by-${{ matrix.java-version }}
41
+ path : target/kaitai-struct-runtime-0.9.jar
42
+
43
+ run :
44
+ runs-on : ubuntu-latest
45
+ needs :
46
+ - build
47
+ strategy :
48
+ fail-fast : false
49
+ matrix :
50
+ built-by-java-version :
51
+ - ' 8'
52
+ - ' 11'
53
+ - ' 17'
54
+ java-version :
55
+ - ' 8'
56
+ - ' 11'
57
+ - ' 17'
58
+
59
+ steps :
60
+ - uses : actions/checkout@v3
61
+ - name : Set up JDK
62
+ uses : actions/setup-java@v3
63
+ with :
64
+ java-version : ${{ matrix.java-version }}
65
+ distribution : ' temurin'
66
+ - uses : actions/download-artifact@v3
67
+ with :
68
+ name : ks-runtime-built-by-${{ matrix.built-by-java-version }}
69
+ - name : Compile
70
+ run : javac -encoding UTF-8 -cp kaitai-struct-runtime-0.9.jar -d bin *.java
71
+ - name : Run
72
+ run : java -cp 'bin:kaitai-struct-runtime-0.9.jar' App
Original file line number Diff line number Diff line change
1
+ /bin
2
+ * .class
Original file line number Diff line number Diff line change
1
+ import io .kaitai .struct .ByteBufferKaitaiStream ;
2
+ import java .io .IOException ;
3
+
4
+ public class App {
5
+ public static void main (String [] args ) throws IOException {
6
+ byte [] data = { (byte ) 0xd4 };
7
+ HelloWorld hw = new HelloWorld (new ByteBufferKaitaiStream (data ));
8
+
9
+ System .out .println ("one: " + hw .one ());
10
+ if (hw .one () == 212 ) {
11
+ System .out .println ("OK" );
12
+ } else {
13
+ System .out .println ("Error" );
14
+ System .exit (1 );
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ // This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
2
+
3
+ import io .kaitai .struct .ByteBufferKaitaiStream ;
4
+ import io .kaitai .struct .KaitaiStruct ;
5
+ import io .kaitai .struct .KaitaiStream ;
6
+ import java .io .IOException ;
7
+
8
+ public class HelloWorld extends KaitaiStruct {
9
+ public static HelloWorld fromFile (String fileName ) throws IOException {
10
+ return new HelloWorld (new ByteBufferKaitaiStream (fileName ));
11
+ }
12
+
13
+ public HelloWorld (KaitaiStream _io ) {
14
+ this (_io , null , null );
15
+ }
16
+
17
+ public HelloWorld (KaitaiStream _io , KaitaiStruct _parent ) {
18
+ this (_io , _parent , null );
19
+ }
20
+
21
+ public HelloWorld (KaitaiStream _io , KaitaiStruct _parent , HelloWorld _root ) {
22
+ super (_io );
23
+ this ._parent = _parent ;
24
+ this ._root = _root == null ? this : _root ;
25
+ _read ();
26
+ }
27
+ private void _read () {
28
+ this .one = this ._io .readU1 ();
29
+ }
30
+ private int one ;
31
+ private HelloWorld _root ;
32
+ private KaitaiStruct _parent ;
33
+ public int one () { return one ; }
34
+ public HelloWorld _root () { return _root ; }
35
+ public KaitaiStruct _parent () { return _parent ; }
36
+ }
Original file line number Diff line number Diff line change
1
+ meta :
2
+ id : hello_world
3
+ seq :
4
+ - id : one
5
+ type : u1
You can’t perform that action at this time.
0 commit comments