{@inheritDoc}

@see org.jboss.shrinkwrap.api.exporter.ExplodedExporter#exportExploded(java.io.File, java.lang.String)
423478
@Override
    public File exportExploded(File baseDirectory, String directoryName) {
        final Archive<?> archive = this.getArchive();
        Validate.notNull(archive, "No archive provided");
        Validate.notNull(baseDirectory, "No baseDirectory provided");

        // Directory must exist
        if (!baseDirectory.exists()) {
            throw new IllegalArgumentException("Parent directory does not exist");
        }
        // Must be a directory
        if (!baseDirectory.isDirectory()) {
            throw new IllegalArgumentException("Provided parent directory is not a valid directory");
        }

        return export(archive, new File(baseDirectory, directoryName));
    }
198621
@Override
    public final void exportTo(final File target, final boolean overwrite) throws ArchiveExportException,
        FileExistsException {
        // Get stream and perform precondition checks
        final OutputStream out = this.getOutputStreamToFile(target, overwrite);

        try {
            // Write out
            this.exportTo(out);
        } finally {
            // Close
            try {
                out.close();
            } catch (final IOException ioe) {
                // Just log
                log.warning("Could not close " + out + ": " + ioe);
            }
        }
    }
298626
@Override
    public ExplodedImporter importDirectory(File file, Filter<ArchivePath> filter) {
        Validate.notNull(file, "File must be specified");
        Validate.notNull(filter, "Filter must be specified");
        if (!file.isDirectory()) {
            throw new IllegalArgumentException("Given file is not a directory " + file.getAbsolutePath());
        }

        doImport(file, file.listFiles(), filter);
        return this;
    }
58003
@Override
    public ExplodedImporter importDirectory(String fileName, Filter<ArchivePath> filter) {
        Validate.notNull(fileName, "FileName must be specified");
        return importDirectory(new File(fileName), filter);
    }
513190
function (filePatterns, destination, options) {
  try {
    var fse = require('fs-extra')
  } catch (e) {
    console.error('This method can only be used in server applications.\n' +
      'Consider using the alternative method "i18nCompile.fromString()" instead.')
  }

  options = options || {};
  var matchedFiles = _.map(filePatterns, function (pattern) {
    return glob.sync(pattern);
  });

  var files = _.uniq(_.flatten(matchedFiles));

  var srcList = files.filter(function (filepath) {
    // Warn on and remove invalid source files (if nonull was set).
    try {
      fse.accessSync(filepath);
      return true;
    } catch (e) {
      console.warn('Source file "' + filepath + '" not found.');
      return false;
    }
  }).map(function (filepath) {
    // Read YAML file.
    var content = yaml.safeLoad(fse.readFileSync(filepath, 'utf8'), {
      filename: filepath,
      schema: yaml.JSON_SCHEMA
    });

    return new SrcItem(filepath, content);
  });

  var compiled = compileTranslations(srcList);

  // Handle options.
  if (options.merge) {
    // Write the destination file(with all languages merged in the same file).
    fse.outputFileSync(destination, JSON.stringify(compiled));

    // Print a success message.
    console.log('File "' + destination + '" created.');

    return;
  }

  // Write the destination files.
  for (var lang in compiled) {
    var fileDest = langFileDest(destination, lang, options.langPlace);
    fse.outputFileSync(fileDest, JSON.stringify(compiled[lang]));

    // Print a success message.
    console.log('File "' + fileDest + '" created.');
  }
}
910177
static void export(String xmlPath, List<JobDef> jobDefList, DbConn cnx) throws JqmXmlException
    {
        // Argument tests
        if (xmlPath == null)
        {
            throw new IllegalArgumentException("file path cannot be null");
        }

        // Create XML into file
        OutputStream os = null;
        try
        {
            os = new FileOutputStream(xmlPath);
            export(os, jobDefList, cnx);
        }
        catch (FileNotFoundException e)
        {
            throw new JqmXmlException(e);
        }
        finally
        {
            try
            {
                os.close();
            }
            catch (IOException e)
            {
                // Who cares.
            }
        }
    }
360841
@Override
    public void to(final Node node, final OutputStream out) throws DescriptorExportException {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document root = builder.newDocument();
            root.setXmlStandalone(true);

            writeRecursive(root, node);

            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");

            StreamResult result = new StreamResult(out);
            transformer.transform(new DOMSource(root), result);
        } catch (Exception e) {
            throw new DescriptorExportException("Could not export Node structure to XML", e);
        }
    }
344643
void createTotalSpecifications(final File dir, final String packageDirectory) throws MojoExecutionException {

        if (dir.equals(null)) {
            throw new MojoExecutionException("Could not read from directory " + dir.getPath());
        }
        final File[] files = dir.listFiles();
        if (files == null) {
            return;
        }
        final File[] providedContextFiles = dir.listFiles((java.io.FileFilter) FileFilterUtils.andFileFilter(FileFilterUtils.fileFileFilter(), FileFilterUtils.nameFileFilter("providedcontext.json")));
        if (providedContextFiles.length == 1) {
            final File parent = providedContextFiles[0].getParentFile();
            final File outputDir = new File(getSpecificationOutput() + File.separator + packageDirectory.substring(0,packageDirectory.lastIndexOf(File.separator)));
            outputDir.mkdirs();
            try {
                generateTotalSpecification(parent, outputDir);
            } catch (final CodeGenException e) {
                throw new MojoExecutionException("Couldn't create total specification",e);
            }
        }
        for (File entry : dir.listFiles()) {
            if (entry.isDirectory()) {
                createTotalSpecifications(entry, (packageDirectory == null) ? entry.getName() : packageDirectory + File.separator + entry.getName());
            }
        }
    }
1085241
function serializeFile(file) {

  // preserve path, source, and file-save props
  var o = u.pick(file, 'path', '_oldtext', '_dirty');

  // recreate file.text from serialized fragments
  // new or modifified fragments should delete file.text
  o.text = file.text || serializeTextFragments(file);

  return o;
}
1226174
private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) {
        if (destFile.exists()) {
            throw new IllegalArgumentException("The destination file already existed: " + destFile.getAbsolutePath());
        }

        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;

        try {
            fis = new FileInputStream(srcFile);
            fos = new FileOutputStream(destFile);
            input = fis.getChannel();
            output = fos.getChannel();

            long size = input.size();
            long pos = 0;
            long count = 0;

            while (pos < size) {
                count = ((size - pos) > FILE_COPY_BUFFER_SIZE) ? FILE_COPY_BUFFER_SIZE : (size - pos);
                pos += output.transferFrom(input, pos, count);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            close(output);
            close(fos);
            close(input);
            close(fis);
        }

        if (srcFile.length() != destFile.length()) {
            deleteAllIfExists(destFile);
            throw new UncheckedIOException(new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'"));
        }

        if (preserveFileDate) {
            destFile.setLastModified(srcFile.lastModified());
        }
    }
990661
private void doExport(final String fileName) throws FrameworkException {

		// collect all nodes etc that belong to the frontend (including files)
		// and export them to the given output file
		final Set<RelationshipInterface> rels = new LinkedHashSet<>();
		final Set<NodeInterface> nodes        = new LinkedHashSet<>();
		final Set<String> filePaths           = new LinkedHashSet<>();
		final App app                         = StructrApp.getInstance();

		try (final Tx tx = app.tx()) {

			// collect folders that are marked for export
			for (final Folder folder : app.nodeQuery(Folder.class).and(StructrApp.key(Folder.class, "includeInFrontendExport"), true).getAsList()) {

				collectDataRecursively(app, folder, nodes, rels, filePaths);
			}

			// collect pages (including files, shared components etc.)
			for (final Page page : app.nodeQuery(Page.class).getAsList()) {

				collectDataRecursively(app, page, nodes, rels, filePaths);
			}

			SyncCommand.exportToFile(fileName, nodes, rels, filePaths, true);

			tx.success();
		}
	}
957985
public void exportModule(String moduleName) throws Exception {

        CmsModule module = OpenCms.getModuleManager().getModule(moduleName);

        if (module == null) {
            throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_UNKNOWN_MODULE_1, moduleName));
        }

        String filename = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(
            OpenCms.getSystemInfo().getPackagesRfsPath()
                + CmsSystemInfo.FOLDER_MODULES
                + moduleName
                + "_"
                + OpenCms.getModuleManager().getModule(moduleName).getVersion().toString());

        List<String> moduleResources = CmsModule.calculateModuleResourceNames(m_cms, module);
        String[] resources = new String[moduleResources.size()];
        System.arraycopy(moduleResources.toArray(), 0, resources, 0, resources.length);

        // generate a module export handler
        CmsModuleImportExportHandler moduleExportHandler = new CmsModuleImportExportHandler();
        moduleExportHandler.setFileName(filename);
        moduleExportHandler.setAdditionalResources(resources);
        moduleExportHandler.setModuleName(module.getName().replace('\\', '/'));
        moduleExportHandler.setDescription(
            getMessages().key(
                Messages.GUI_SHELL_IMPORTEXPORT_MODULE_HANDLER_NAME_1,
                new Object[] {moduleExportHandler.getModuleName()}));

        // export the module
        OpenCms.getImportExportManager().exportData(
            m_cms,
            moduleExportHandler,
            new CmsShellReport(m_cms.getRequestContext().getLocale()));
    }
774902
@Override
    public ExternalPortletType exportData(String id) {
        IPortletType portletType = this.portletTypeRegistry.getPortletType(Integer.parseInt(id));
        if (null == portletType) {
            return null;
        }

        return convert(portletType);
    }
1147864
@Override
    public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException{
        GeoJsonWriteDriver geoJsonDriver = new GeoJsonWriteDriver(connection);
        geoJsonDriver.write(progress,tableReference, fileName, encoding);
    }
760096
private void exportToCsv(File exportFile) {
        FileWriter fileWriter = null;
        exportStatus=true;
        try {
            fileWriter = new FileWriter(exportFile);
            CSVWriter writer = new CSVWriter(fileWriter);
            List<Marker> markers = datastore.getBookmarksAsMarkers(getmMapView());
            String[] headers = new String[] {"Latitude","Longitude","Description","Title"};
            writer.writeNext(headers);
            for (Marker m: markers) {
                String[] items = new String[4];
                items[0] = m.getPosition().getLatitude()+"";
                items[1] = m.getPosition().getLongitude()+"";
                items[2] = m.getSubDescription();
                items[3] = m.getTitle();
                writer.writeNext(items);
            }
        }catch (Exception ex) {
            exportStatus=false;
            ex.printStackTrace();
        } finally {
            if (fileWriter!=null)
                try {
                    fileWriter.close();
                }catch (Exception ex) {}
        }
        final Activity act = getActivity();
        if (act!=null) {
            act.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (exportStatus) {
                        Toast.makeText(act, "Export Complete", Toast.LENGTH_LONG).show();
                    } else
                        Toast.makeText(act, "Export Failed", Toast.LENGTH_LONG).show();
                }
            });
        }
    }
566709
protected void removeOldExport(String exportPath) {

        File output = new File(exportPath);
        if (output.exists()) {
            // the output already exists
            if (output.isDirectory()) {
                // purge the complete directory
                CmsFileUtil.purgeDirectory(output);
            } else {
                // remove the existing file
                if (m_isExportAsFiles) {
                    // in case we write to a file we can just overwrite,
                    // but for a folder we must remove an existing file
                    output.delete();
                }
            }
        }
    }
56875
@Override
    public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException {
        JsonWriteDriver jsonDriver = new JsonWriteDriver(connection);
        jsonDriver.write(progress,tableReference, fileName, encoding);
    }