code: public long estimateSize(JournalEntry journalEntry) throws JournalException {
          try {
              long totalFileSizes = 0;
  
              // Initialize the copy of the JournalEntry
              CreatorJournalEntry copyEntry =
                      new CreatorJournalEntry(journalEntry.getMethodName(),
                                              journalEntry.getContext());
  
              // Add arguments to the copy of the JournalEntry, except for File
              // arguments. Calculate any file sizes here.
              Map<String, Object> argumentsMap = journalEntry.getArgumentsMap();
              for (String name : argumentsMap.keySet()) {
                  Object value = argumentsMap.get(name);
                  if (value instanceof File) {
                      totalFileSizes += estimateFileSize((File) value);
                      copyEntry.addArgument(name, (File) null);
                  } else {
                      copyEntry.addArgument(name, value);
                  }
              }
  
              // Create an XMLEventWriter on a StringBuffer, and ask the
              // JournalWriter to write the copy of the JournalEntry to it.
              StringWriter stringWriter = new StringWriter();
              XMLEventWriter xmlEventWriter = createXmlEventWriter(stringWriter);
              journalWriter.writeJournalEntry(copyEntry, xmlEventWriter);
  
              // Add the size of the formatted string to the size of the encoded
              // files.
              return totalFileSizes + stringWriter.getBuffer().length();
          } catch (FactoryConfigurationError e) {
              throw new JournalException("can't estimate the size of a JournalEntry",
                                         e);
          } catch (XMLStreamException e) {
              throw new JournalException("can't estimate the size of a JournalEntry",
                                         e);
          }
      }
docs: Create a modified entry, minus any file arguments, and ask the
  JournalWriter to format it so we can check the size. The size of the
  file(s) can be determined separately.
  
  @throws JournalException