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_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 RtdeTextMessage read(DataInputStream di, int length) throws IOException { 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,0); return this; } }