code: private void writeFileArgument(String key, File file, XMLEventWriter writer)
              throws XMLStreamException, JournalException {
          try {
              putStartTag(writer, QNAME_TAG_ARGUMENT);
              putAttribute(writer, QNAME_ATTR_NAME, key);
              putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM);
  
              EncodingBase64InputStream encoder =
                      new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file)));
              String encodedChunk;
              while (null != (encodedChunk = encoder.read(1000))) {
                  putCharacters(writer, encodedChunk);
              }
              encoder.close();
              putEndTag(writer, QNAME_TAG_ARGUMENT);
          } catch (IOException e) {
              throw new JournalException("IO Exception on temp file", e);
          }
      }
docs: An InputStream argument must be written as a Base64-encoded String. It is
  read from the temp file in segments. Each segment is encoded and written
  to the XML writer as a series of character events.