package at.acdp.urweb.rtde.packets; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import static at.acdp.urweb.rtde.CommandType.RTDE_GET_URCONTROL_VERSION; import static at.acdp.urweb.rtde.CommandType.RTDE_TEXT_MESSAGE; public class RtdeTextMessage implements IRtdeData { private int replySize; public String text; public String source; public int warningLevel; @Override public int getType() { return RTDE_TEXT_MESSAGE; } @Override public int getSize() { return 3; } @Override public void setReplySize(int s) { replySize = s; } @Override public RtdeTextMessage read(DataInputStream di) throws IOException { readHeader(di); int mLength=di.readByte(); byte[] msgb=new byte[mLength]; di.readFully(msgb); text=new String(msgb); int sLength=di.readByte(); byte[] sourceb=new byte[sLength]; di.readFully(sourceb); source=new String(sourceb); warningLevel=di.readByte(); return this; } @Override public RtdeTextMessage send(DataOutputStream dos) throws IOException { sendHeader(dos); return this; } }