VersionMessage.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package at.acdp.urweb.sclient.data;
  2. import at.acdp.urweb.CountDataInputStream;
  3. import java.io.DataInputStream;
  4. import java.io.IOException;
  5. public class VersionMessage implements IRead {
  6. public int msgType;
  7. public long tstamp;
  8. public int source;
  9. public int robotMsgType;
  10. public String name;
  11. public int majorVersion;
  12. public int minorVersion;
  13. public int bugFixVersion;
  14. public int buildNumber;
  15. public String buildDate;
  16. public void read(CountDataInputStream in, int size) throws IOException {
  17. int msgSize = in.readInt();
  18. msgType = in.readByte() & 0xff;
  19. tstamp = in.readLong();
  20. source = in.readByte();
  21. robotMsgType = in.readByte();
  22. int projectNameSize = in.readByte() & 0xff;
  23. byte[] nameBytes = new byte[projectNameSize];
  24. in.readFully(nameBytes);
  25. name = new String(nameBytes);
  26. majorVersion = in.readByte() & 0xff;
  27. minorVersion = in.readByte() & 0xff;
  28. bugFixVersion = in.readInt();
  29. buildNumber = in.readInt();
  30. byte[] buildDateBytes = new byte[msgSize - (16 + projectNameSize + 10)];
  31. in.readFully(buildDateBytes);
  32. buildDate = new String(buildDateBytes);
  33. }
  34. @Override
  35. public String toString() {
  36. return "VersionMessage{" +
  37. "msgType=" + msgType +
  38. ", tstamp=" + tstamp +
  39. ", source=" + source +
  40. ", robotMsgType=" + robotMsgType +
  41. ", name='" + name + '\'' +
  42. ", majorVersion=" + majorVersion +
  43. ", minorVersion=" + minorVersion +
  44. ", bugFixVersion=" + bugFixVersion +
  45. ", buildNumber=" + buildNumber +
  46. ", buildDate='" + buildDate + '\'' +
  47. '}';
  48. }
  49. }