嗨我对kaitai struct更新,我如何在eclipse中运行代码 在kaitai struct webide上解析为java(target langage),我已经离开了 通过kaitai结构文档,我仍然有一些疑问,可以有人帮助 我?我已发布已解析的java类和主类
package com.ccx.ccxgw.message.parsers;
import io.kaitai.struct.ByteBufferKaitaiStream;
import io.kaitai.struct.KaitaiStruct;
import io.kaitai.struct.KaitaiStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.nio.charset.Charset;
public class LocationRecord extends KaitaiStruct {
public Map<String, Integer> _attrStart = new HashMap<String, Integer>();
public Map<String, Integer> _attrEnd = new HashMap<String, Integer>();
public Map<String, ArrayList<Integer>> _arrStart = new HashMap<String,
ArrayList<Integer>>();
public Map<String, ArrayList<Integer>> _arrEnd = new HashMap<String,
ArrayList<Integer>>();
public static LocationRecord fromFile(String fileName) throws IOException {
return new LocationRecord(new ByteBufferKaitaiStream(fileName));
}
public static String[] _seqFields = new String[] { "imei", "reserved1",
"reserved2", "latrawintpart", "latrawfloatpart", "lonrawintpart",
"lonrawfloatpart", "reserved3", "lbsinfo", "ta", "p", "mt", "fff", "ddd" };
public LocationRecord(KaitaiStream _io) {
this(_io, null, null);
}
public LocationRecord(KaitaiStream _io, KaitaiStruct _parent) {
this(_io, _parent, null);
}
public LocationRecord(KaitaiStream _io, KaitaiStruct _parent, LocationRecord
_root) {
super(_io);
this._parent = _parent;
this._root = _root == null ? this : _root;
}
public void _read() {
_attrStart.put("imei", this._io.pos());
this.imei = this._io.readBytes(15);
_attrEnd.put("imei", this._io.pos());
_attrStart.put("reserved1", this._io.pos());
this.reserved1 = this._io.readBytes(6);
_attrEnd.put("reserved1", this._io.pos());
_attrStart.put("reserved2", this._io.pos());
this.reserved2 = this._io.readBytes(6);
_attrEnd.put("reserved2", this._io.pos());
_attrStart.put("latrawintpart", this._io.pos());
this.latrawintpart = this._io.readU2be();
_attrEnd.put("latrawintpart", this._io.pos());
_attrStart.put("latrawfloatpart", this._io.pos());
this.latrawfloatpart = this._io.readU2be();
_attrEnd.put("latrawfloatpart", this._io.pos());
_attrStart.put("lonrawintpart", this._io.pos());
this.lonrawintpart = this._io.readU2be();
_attrEnd.put("lonrawintpart", this._io.pos());
_attrStart.put("lonrawfloatpart", this._io.pos());
this.lonrawfloatpart = this._io.readU2be();
_attrEnd.put("lonrawfloatpart", this._io.pos());
_attrStart.put("reserved3", this._io.pos());
this.reserved3 = this._io.readBytes(3);
_attrEnd.put("reserved3", this._io.pos());
_attrStart.put("lbsinfo", this._io.pos());
this.lbsinfo = new String(this._io.readBytes(3),
Charset.forName("ASCII"));
_attrEnd.put("lbsinfo", this._io.pos());
_attrStart.put("ta", this._io.pos());
this.ta = new String(this._io.readBytes(8), Charset.forName("ASCII"));
_attrEnd.put("ta", this._io.pos());
_attrStart.put("p", this._io.pos());
this.p = new String(this._io.readBytes(8), Charset.forName("ASCII"));
_attrEnd.put("p", this._io.pos());
_attrStart.put("mt", this._io.pos());
this.mt = new String(this._io.readBytes(8), Charset.forName("ASCII"));
_attrEnd.put("mt", this._io.pos());
_attrStart.put("fff", this._io.pos());
this.fff = new String(this._io.readBytes(8), Charset.forName("ASCII"));
_attrEnd.put("fff", this._io.pos());
_attrStart.put("ddd", this._io.pos());
this.ddd = new String(this._io.readBytes(8), Charset.forName("ASCII"));
_attrEnd.put("ddd", this._io.pos());
}
private Double latitude;
public Double latitude() {
if (this.latitude != null)
return this.latitude;
double _tmp = (double) ((latitudeintpart() + latitudefloatpart()));
this.latitude = _tmp;
return this.latitude;
}
private Double longitude;
public Double longitude() {
if (this.longitude != null)
return this.longitude;
double _tmp = (double) ((longitudeintpart() + longitudefloatpart()));
this.longitude = _tmp;
return this.longitude;
}
private Double latitudefloatpart;
public Double latitudefloatpart() {
if (this.latitudefloatpart != null)
return this.latitudefloatpart;
double _tmp = (double) ((((((latrawintpart() * 10000) +
latrawfloatpart()) - (latitudeintpart() * 1000000)) * 0.0001) / 60));
this.latitudefloatpart = _tmp;
return this.latitudefloatpart;
}
private Double longitudefloatpart;
public Double longitudefloatpart() {
if (this.longitudefloatpart != null)
return this.longitudefloatpart;
double _tmp = (double) ((((((lonrawintpart() * 10000) +
lonrawfloatpart()) - (longitudeintpart() * 1000000)) * 0.0001) / 60));
this.longitudefloatpart = _tmp;
return this.longitudefloatpart;
}
private Integer longitudeintpart;
public Integer longitudeintpart() {
if (this.longitudeintpart != null)
return this.longitudeintpart;
int _tmp = (int) ((((lonrawintpart() * 10000) + lonrawfloatpart()) /
1000000));
this.longitudeintpart = _tmp;
return this.longitudeintpart;
}
private Integer latitudeintpart;
public Integer latitudeintpart() {
if (this.latitudeintpart != null)
return this.latitudeintpart;
int _tmp = (int) ((((latrawintpart() * 10000) + latrawfloatpart()) /
1000000));
this.latitudeintpart = _tmp;
return this.latitudeintpart;
}
private byte[] imei;
private byte[] reserved1;
private byte[] reserved2;
private int latrawintpart;
private int latrawfloatpart;
private int lonrawintpart;
private int lonrawfloatpart;
private byte[] reserved3;
private String lbsinfo;
private String ta;
private String p;
private String mt;
private String fff;
private String ddd;
private LocationRecord _root;
private KaitaiStruct _parent;
public byte[] imei() { return imei; }
public byte[] reserved1() { return reserved1; }
public byte[] reserved2() { return reserved2; }
public int latrawintpart() { return latrawintpart; }
public int latrawfloatpart() { return latrawfloatpart; }
public int lonrawintpart() { return lonrawintpart; }
public int lonrawfloatpart() { return lonrawfloatpart; }
public byte[] reserved3() { return reserved3; }
public String lbsinfo() { return lbsinfo; }
public String ta() { return ta; }
public String p() { return p; }
public String mt() { return mt; }
public String fff() { return fff; }
public String ddd() { return ddd; }
public LocationRecord _root() { return _root; }
public KaitaiStruct _parent() { return _parent; }
}
package com.ccx.ccxgw.message.parsers;
public class test {
public static void main(String[] args) {
try {
LocationRecord lr =
LocationRecord.fromFile("D:\\Projects\\CcxParser\\CcxParsers\\loc.data");
lr.imei();
lr.reserved1();
lr.reserved2();
lr.latrawintpart();
lr.latrawfloatpart();
lr.lonrawintpart();
lr.lonrawfloatpart();
lr.reserved3();
lr.lbsinfo();
lr.ta();
lr.p();
lr.mt();
lr.fff();
lr.ddd();
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
}
请告诉我应该做什么修改,如果可能的话,请提供给我
用于调用kaitai struct类方法的主类的片段。我要解析这条消息{354105059135656,010104,164536,12.888888,77.5564499,100,lbs,ta,p,mt,fff,ddd}