code: public void writeText(String indexedHash, String text)
              throws JournalException {
          if (journalFile == null) {
              throw logAndGetException("Attempting to write when no file "
                      + "is open.");
          }
  
          String calculatedHash =
                  RmiJournalReceiverHelper
                          .figureIndexedHash(currentRepositoryHash, itemIndex);
          if (!calculatedHash.equals(indexedHash)) {
              logger.debug("calculatedHash='" + calculatedHash + "', providedHash='"
                      + indexedHash + "'");
              throw logAndGetException("indexed hash is incorrect.");
          }
  
          try {
              writer.append(text);
              writer.flush();
          } catch (IOException e) {
              throw logAndGetException("Failed to write to '"
                      + journalFile.getName() + "'", e);
          }
  
          logger.debug("Wrote item #" + itemIndex + " to file '"
                  + journalFile.getName() + "'");
          itemIndex++;
      }
docs: Request to write text to the current journal file. Check that:
  <ul>
  <li>a file is open,</li>
  <li>the supplied indexedHash matches the one we calculate,</li>
  <li>the write is successful.</li>
  </ul>
  Increment the itemIndex after a successful write.