Class AbstractCommunicator

java.lang.Object
zleurtor.scanmanager.model.AbstractCommunicator
Direct Known Subclasses:
Master, Slave

public abstract class AbstractCommunicator extends Object
The mother class of entity objects that can communicate (ie read/write messages).
Author:
Zleurtor
  • Constructor Details

    • AbstractCommunicator

      public AbstractCommunicator()
  • Method Details

    • readMessage

      protected AbstractMessage readMessage(InputStream in) throws IOException
      Read a message from the specified input stream.
      Parameters:
      in - The input stream from which the next message shall be read.
      Returns:
      The next message in the specified stream.
      Throws:
      IOException - If any exception occurs.
    • writeMessage

      protected void writeMessage(OutputStream out, AbstractMessage message) throws IOException
      Write the specified message into the specified output stream.
      Parameters:
      out - The output stream into which the next message shall be written.
      message - The message which shall be written.
      Throws:
      IOException - If any exception occurs.