Interface ICommandLineDevice

All Superinterfaces:
AutoCloseable, Closeable, IHarcHardware
All Known Implementing Classes:
BufferedExecutor, GirsClient, GlobalCache.SerialPort, LocalSerialPortBuffered, TcpSocketChannel, TcpSocketPort, UdpSocketPort, UrlPort

public interface ICommandLineDevice extends IHarcHardware
This interface specifies a device that can be sent commands, and that can be queried for responses.
  • Method Details

    • sendString

      void sendString(String cmd) throws IOException, HarcHardwareException
      Sends a command (a String) to the instance.
      Parameters:
      cmd - Command string to be sent.
      Throws:
      IOException
      HarcHardwareException
    • readString

      String readString() throws IOException
      Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
      Returns:
      A String containing the contents of the line, not including any line-termination characters, or null if no input available.
      Throws:
      IOException
    • readString

      String readString(boolean wait) throws IOException
      Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
      Parameters:
      wait - if true, wait until something arrives, otherwise return null if nothing there.
      Returns:
      A String containing the contents of the line, not including any line-termination characters, or null if no input available.
      Throws:
      IOException
    • ready

      boolean ready() throws IOException
      Tells whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready.
      Returns:
      True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
      Throws:
      IOException - If an I/O error occurs
    • flushInput

      void flushInput() throws IOException
      Throws:
      IOException