code: void clearInput() throws IOException {
          if (commPort.bytesAvailable() > 0) {
              int len = commPort.bytesAvailable();
              byte buf[] = new byte[len];
              readBytes(buf, len);
              if (logger.isDebugEnabled()) {
                  logger.debug("Clear input: {}", ModbusUtil.toHex(buf, 0, len));
              }
          }
      }
docs: clearInput - Clear the input if characters are found in the input stream.
  
  @throws IOException If a problem with the port