code: protected void writeResource(
          HttpServletRequest req,
          String exportPath,
          String rfsName,
          CmsResource resource,
          byte[] content)
      throws CmsException {
  
          String exportFileName = CmsFileUtil.normalizePath(exportPath + rfsName);
  
          // make sure all required parent folder exist
          createExportFolder(exportPath, rfsName);
          // generate export file instance and output stream
          File exportFile = new File(exportFileName);
          // write new exported file content
          try {
              FileOutputStream exportStream = new FileOutputStream(exportFile);
              exportStream.write(content);
              exportStream.close();
  
              // log export success
              if (LOG.isInfoEnabled()) {
                  LOG.info(
                      Messages.get().getBundle().key(
                          Messages.LOG_STATIC_EXPORTED_2,
                          resource.getRootPath(),
                          exportFileName));
              }
  
          } catch (Throwable t) {
              throw new CmsStaticExportException(
                  Messages.get().container(Messages.ERR_OUTPUT_STREAM_1, exportFileName),
                  t);
          }
          // update the file with the modification date from the server
          if (req != null) {
              Long dateLastModified = (Long)req.getAttribute(CmsRequestUtil.HEADER_OPENCMS_EXPORT);
              if ((dateLastModified != null) && (dateLastModified.longValue() != -1)) {
                  exportFile.setLastModified((dateLastModified.longValue() / 1000) * 1000);
                  if (LOG.isDebugEnabled()) {
                      LOG.debug(
                          Messages.get().getBundle().key(
                              Messages.LOG_SET_LAST_MODIFIED_2,
                              exportFile.getName(),
                              new Long((dateLastModified.longValue() / 1000) * 1000)));
                  }
              }
          } else {
              // otherwise take the last modification date form the OpenCms resource
              exportFile.setLastModified((resource.getDateLastModified() / 1000) * 1000);
          }
      }
docs: Writes a resource to the given export path with the given rfs name and the given content.<p>
  
  @param req the current request
  @param exportPath the path to export the resource
  @param rfsName the rfs name
  @param resource the resource
  @param content the content
  
  @throws CmsException if something goes wrong