package controlledparts; public class AMessage { private int time; private String head; private byte[] data; private int length; public AMessage(){ head=""; data=new byte[0]; length=0; } public AMessage(String h, byte[] d){ this.head=h; this.data=d; this.length=d.length; } public void setTime(int x){ this.time=x; } public int getTime(){ return time; } public String getHead(){ return head; } public byte[] getData(){ return data; } public void setHead(String h){ this.head=h; } public void setData(byte[] d){ this.data=d; this.length=d.length; } public void setData(byte[] d,int l){ this.data=d; this.length=l; } public int getDataLength(){ return this.length; } public void setDataLength(int x){ this.length=x; } public byte[] getBytes(){ byte[] hb=head.getBytes(); int hl=hb.length; byte [] rtn=new byte[4+4+hl+4+length]; rtn[0]=(byte)((hl>>24) & 0x000000ff); rtn[1]=(byte)((hl>>16) & 0x000000ff); rtn[2]=(byte)((hl>>8) & 0x000000ff); rtn[3]=(byte)(hl & 0x000000ff); for(int i=0;i>24) & 0x000000ff); rtn[4+hl+1]=(byte)((length>>16) & 0x000000ff); rtn[4+hl+2]=(byte)((length>>8) & 0x000000ff); rtn[4+hl+3]=(byte)(length & 0x000000ff); for(int i=0;i