package it.rafa.test; import java.io.Serializable; public class MyMessage implements Serializable{ public static byte stx= 0x02; private int len; private byte[] msg; public static byte etx = 0x03; public MyMessage() { super(); } public MyMessage(int len, byte[] msg) { super(); this.len = len; this.msg = msg; } public int getLen() { return len; } public void setLen(int len) { this.len = len; } public byte[] getMsg() { return msg; } public void setMsg(byte[] msg) { this.msg = msg; } public byte[] toArray() { byte[] v = new byte[3 + msg.length]; v[0]=stx; v[v.length-1]=etx; v[1] = (byte)v.length; for(int i=2;iString with all attributes * in name = value format. * * @return a String representation * of this object. */ public String toString() { final String TAB = " "; String retValue = ""; retValue = "MyMessage ( " + super.toString() + TAB + "len = " + this.len + TAB + "msg = " + this.msg + TAB + "msgStr = " + new String(this.msg) + TAB + " )"; return retValue; } }