IRtdeData.java 619 B

12345678910111213141516171819202122232425
  1. package at.acdp.urweb.rtde.packets;
  2. import at.acdp.urweb.rtde.RTDEClient;
  3. import org.slf4j.LoggerFactory;
  4. import java.io.DataInputStream;
  5. import java.io.DataOutputStream;
  6. import java.io.IOException;
  7. public interface IRtdeData<T> {
  8. final static org.slf4j.Logger logger = LoggerFactory.getLogger(RTDEClient.class);
  9. int getType();
  10. T read(DataInputStream di, int length) throws IOException;
  11. T send(DataOutputStream dos) throws IOException;
  12. default void sendHeader(DataOutputStream dos, int length) throws IOException {
  13. dos.writeShort(length+3);
  14. dos.writeByte(getType());
  15. }
  16. }