code: final int writeBytes(byte[] buffer, long bytesToWrite) throws IOException {
          if (commPort != null && commPort.isOpen()) {
              return commPort.writeBytes(buffer, bytesToWrite);
          }
          else {
              throw new IOException("Comm port is not valid or not open");
          }
      }
docs: Writes the bytes to the output stream
  
  @param buffer       Buffer to write
  @param bytesToWrite Number of bytes to write
  @return Number of bytes written
  
  @throws java.io.IOException if writing to invalid port