This is a utility method that can be used to dump the contents of the iidToIvfpqDB to a txt file.<br>
Currently, only the list id of each item is dumped.

@param dumpFilename
Full path to the file where the dump will be written.
@throws Exception
165616
public void dumpIidToIvfpqDB(String dumpFilename) throws Exception {
		DatabaseEntry foundKey = new DatabaseEntry();
		DatabaseEntry foundData = new DatabaseEntry();

		ForwardCursor cursor = iidToIvfpqDB.openCursor(null, null);
		BufferedWriter out = new BufferedWriter(new FileWriter(new File(dumpFilename)));
		while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
			int iid = IntegerBinding.entryToInt(foundKey);
			TupleInput input = TupleBinding.entryToInput(foundData);
			int listId = input.readInt();
			out.write(iid + " " + listId + "\n");
		}
		cursor.close();
		out.close();
	}
1277665
public static void writeOutContent(final byte[] data, final String filename, final String mime) {
        writeOutContent(data, filename, mime, true);
    }
1036216
public void save(String fileString) throws Exception {

// oj@openoffice.org
        fa.createParentDirs(fileString);

        OutputStream        fos = fa.openOutputStreamElement(fileString);
        FileAccess.FileSync outDescriptor = fa.getFileSync(fos);

        JavaSystem.saveProperties(
            stringProps,
            HsqlDatabaseProperties.PRODUCT_NAME + " "
            + HsqlDatabaseProperties.THIS_FULL_VERSION, fos);
        fos.flush();
        outDescriptor.sync();
        fos.close();

        return;
    }
1034870
public static void dumpAnalysisToFile(String outputDirName,
                                          String baseFileName,
                                          PartitionBalance partitionBalance) {
        if(outputDirName != null) {
            File outputDir = new File(outputDirName);
            if(!outputDir.exists()) {
                Utils.mkdirs(outputDir);
            }

            try {
                FileUtils.writeStringToFile(new File(outputDirName, baseFileName + ".analysis"),
                                            partitionBalance.toString());
            } catch(IOException e) {
                logger.error("IOException during dumpAnalysisToFile: " + e);
            }
        }
    }
700558
@SuppressWarnings("OptionalGetWithoutIsPresent")
  @Override
  public void run() throws Exception {
    final Optional<File> inputMapFile = parameters.getOptionalExistingFile(INPUT_MAP_PARAM);
    final Optional<File> inputListFile = parameters.getOptionalExistingFile(INPUT_LIST_PARAM);
    final Optional<File> outputMapFile = parameters.getOptionalCreatableFile(OUTPUT_MAP_PARAM);
    final Optional<File> outputListFile = parameters.getOptionalCreatableFile(OUTPUT_LIST_PARAM);
    final Optional<File> outputDirectory =
        parameters.getOptionalCreatableDirectory(OUTPUT_DIR_PARAM);
    final boolean inPlace = parameters.getOptionalBoolean(IN_PLACE_PARAM).or(false);
    final Optional<File> basePath = parameters.getOptionalExistingDirectory(BASE_PATH_PARAM);

    if (inputListFile.isPresent() == inputMapFile.isPresent()) {
      log.error("Exactly one input parameter given. Expected exactly one of {} and {}",
          INPUT_LIST_PARAM, INPUT_MAP_PARAM);
      System.exit(1);
    }

    if (!outputListFile.isPresent() && !outputMapFile.isPresent() && !inPlace) {
      log.error("No output parameter given. Expected {} or {} or for {} to be true",
          OUTPUT_LIST_PARAM, OUTPUT_MAP_PARAM, IN_PLACE_PARAM);
      System.exit(1);
    }

    if (outputMapFile.isPresent() && !inputMapFile.isPresent()) {
      log.error("Cannot use {} without {}", OUTPUT_MAP_PARAM, INPUT_MAP_PARAM);
      System.exit(1);
    }

    if (!inPlace && !basePath.isPresent()) {
      log.error("Cannot determine whow to output. Either {} must be true or {} must be "
          + "specified", IN_PLACE_PARAM, BASE_PATH_PARAM);
    }

    final ImmutableMap<Symbol, File> inputFileMap;
    if (inputMapFile.isPresent()) {
      inputFileMap = FileUtils.loadSymbolToFileMap(inputMapFile.get());
    } else {
      // if a map wasn't supplied, we make a fake map using the file path as the key.
      // we know the key won't matter, because we know map output wasn't requested or
      // the checks above would have caught the missing input map
      // .get() is safe by checks above
      inputFileMap = Maps.uniqueIndex(FileUtils.loadFileList(inputListFile.get()),
          compose(symbolizeFunction(), toAbsolutePathFunction()));
    }
    log.info("Cleaning {} input files {}", inputFileMap.size(),
        inPlace ? "in-place" : ("to " + outputDirectory.get().getAbsolutePath()));

    int totalCharactersReplaced = 0;
    int numFilesWithReplacements = 0;

    final ImmutableList.Builder<File> outputFiles = ImmutableList.builder();
    final ImmutableMap.Builder<Symbol, File> outputMap = ImmutableMap.builder();
    for (final Map.Entry<Symbol, File> e : inputFileMap.entrySet()) {
      final File inputFileName = e.getValue();
      final File outFile;
      if (inPlace) {
        outFile = inputFileName;
      } else {
        // write the output to a file with the same position relative to the output directory
        // as the input had relative to the input directory
        // get safe by checks above
        //noinspection OptionalGetWithoutIsPresent
        outFile = outputDirectory.get().toPath().resolve(
            basePath.get().toPath().relativize(inputFileName.toPath())).toFile();
      }
      //noinspection ResultOfMethodCallIgnored
      outFile.getParentFile().mkdirs();

      final String originalText = Files.asCharSource(inputFileName, Charsets.UTF_8).read();
      final int numReplacementCharsInOriginal =
          CodepointMatcher.forCharacter(UNICODE_REPLACEMENT_CHARACTER).countIn(originalText);
      final String cleanedText = not(basicMultilingualPlane()).replaceAll(
          originalText, UNICODE_REPLACEMENT_CHARACTER);
      final int numReplacementCharsInCleaned =
          CodepointMatcher.forCharacter(UNICODE_REPLACEMENT_CHARACTER).countIn(cleanedText);
      Files.asCharSink(outFile, Charsets.UTF_8).write(cleanedText);

      outputFiles.add(outFile);
      outputMap.put(e.getKey(), outFile);

      final int numCharsReplaced = numReplacementCharsInCleaned - numReplacementCharsInOriginal;

      checkState(numCharsReplaced >= 0,
          "Number of replacement characters went down.  Either this program is buggy or you have"
              + " a very broken and bizarre document");
      if (numCharsReplaced > 0) {
        log.info("Replaced {} non-BMP code points with the Unicode replacement character for"
            + "input file {}", numCharsReplaced, inputFileName);
        totalCharactersReplaced += numCharsReplaced;
        ++numFilesWithReplacements;
      }
    }

    log.info("Replaced {} non-BMP characters in {} files",
        totalCharactersReplaced, numFilesWithReplacements);
    if (outputListFile.isPresent()) {
      log.info("Writing list of transformed files to {}", outputListFile.get());
      FileUtils.writeFileList(outputFiles.build(), Files.asCharSink(outputListFile.get(),
          Charsets.UTF_8));
    }
    if (outputMapFile.isPresent()) {
      log.info("Writing map of transformed files to {}", outputMapFile.get());
      FileUtils.writeSymbolToFileMap(outputMap.build(), Files.asCharSink(outputMapFile.get(),
          Charsets.UTF_8));
    }
  }
186174
public static final void fileHexDump(String fileName, byte[] data)
   {
      System.out.println("FILE HEX DUMP");
      try
      {
         FileOutputStream os = new FileOutputStream(fileName);
         os.write(ByteArrayHelper.hexdump(data, true, 16, "").getBytes());
         os.close();
      }

      catch (IOException ex)
      {
         ex.printStackTrace();
      }
   }
1134237
public static void dumpRecipes(String filename) throws IOException
    {
        FileOutputStream fos = new FileOutputStream(filename);
        OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
        BufferedWriter writer = new BufferedWriter(osw);
        List<?> recipes = CraftingManager.getInstance().getRecipeList();
        for (Object obj : recipes)
        {
            if (obj == null)
                continue;
            if (obj instanceof IRecipe)
            {
                ItemStack is = ((IRecipe)obj).getRecipeOutput();
                if (is == null)
                    continue;
                String s = is.getCount() + "x" + is.getUnlocalizedName() + " = ";
                List<ItemStack> ingredients = getIngredients((IRecipe)obj);
                if (ingredients == null)
                    continue;
                boolean first = true;
                for (ItemStack isIngredient : ingredients)
                {
                    if (!first)
                        s += ", ";
                    s += isIngredient.getCount() + "x" + isIngredient.getUnlocalizedName();
                    s += "(" + isIngredient.getDisplayName() + ")";
                    first = false;
                }
                s += "\n";
                writer.write(s);
            }
        }
        Iterator<?> furnaceIt = FurnaceRecipes.instance().getSmeltingList().keySet().iterator();
        while (furnaceIt.hasNext())
        {
            ItemStack isInput = (ItemStack)furnaceIt.next();
            ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(isInput);
            String s = isOutput.getCount() + "x" + isOutput.getUnlocalizedName() + " = FUEL + " + isInput.getCount() + "x" + isInput.getUnlocalizedName() + "\n";
            writer.write(s);
        }
        writer.close();
    }
885576
public static void dump(Appendable appendable, Iterable<?> items) {
		try {
			for(Object item: items) {
				appendable.append(String.valueOf(item));
				appendable.append("\n");
			}
		} catch (IOException e) {
			throw new RuntimeException("An error occured while appending", e);
		}
	}
452102
public static void dumpStoreDefsToFile(String outputDirName,
                                           String fileName,
                                           List<StoreDefinition> storeDefs) {

        if(outputDirName != null) {
            File outputDir = new File(outputDirName);
            if(!outputDir.exists()) {
                Utils.mkdirs(outputDir);
            }

            try {
                FileUtils.writeStringToFile(new File(outputDirName, fileName),
                                            new StoreDefinitionsMapper().writeStoreList(storeDefs));
            } catch(IOException e) {
                logger.error("IOException during dumpStoreDefsToFile: " + e);
            }
        }
    }
370500
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) {

        if(outputDirName != null) {
            File outputDir = new File(outputDirName);
            if(!outputDir.exists()) {
                Utils.mkdirs(outputDir);
            }

            try {
                FileUtils.writeStringToFile(new File(outputDirName, fileName),
                                            new ClusterMapper().writeCluster(cluster));
            } catch(IOException e) {
                logger.error("IOException during dumpClusterToFile: " + e);
            }
        }
    }
931719
public static void writeFileList(XMLOutput xmlOutput, String tagName, Iterable<File> listValues) throws IOException {
        if (listValues != null) {
            writeFileList(xmlOutput, tagName, listValues.iterator());
        }
    }
250984
public static void dumpNumberToFile(final Path filePath, final long num) throws IOException {
    try (final BufferedWriter writer = Files
        .newBufferedWriter(filePath, StandardCharsets.UTF_8)) {
      writer.write(String.valueOf(num));
    } catch (final IOException e) {
      log.error("Failed to write the number {} to the file {}", num, filePath, e);
      throw e;
    }
  }
382138
public void dumpTemplate(String templatePath) throws IOException
    {
        BufferedWriter bw = IOUtil.newBufferedWriter(templatePath);
        String template = getTemplate();
        bw.write(template);
        bw.close();
    }
1086822
public static String getFileContents(String pFileName) throws IOException{
         String fileContents = null;
         InputStream is = new FileInputStream(pFileName);
         BufferedReader reader = new BufferedReader(new InputStreamReader(is));
         StringBuffer xml = new StringBuffer();
         String aLine = null;
         while((aLine = reader.readLine()) != null){
           xml.append(aLine);
           xml.append("\n");

         }
        reader.close();
        fileContents = xml.toString();
        return fileContents;
    }
1191908
private void openInputFile(final String inputFileName) throws IOException
	{
		myInputFile = new File(inputFileName);
		myInputStream = new FileInputStream(myInputFile);
		myStreamReader = new InputStreamReader(myInputStream, getInputEncodingCode());
		myBufferedReader = new BufferedReader(myStreamReader);
		myLineReader = new LineNumberReader(myBufferedReader);
	}
838863
def dump(self, filename):
        
        with open(filename, "w") as f:
            for name in sorted(self._fields):
                self._fields[name].dump(f, name)
1360410
private void writeName(String name) throws IOException
   {
      m_writer.write('"');
      m_writer.write(name);
      m_writer.write('"');
      m_writer.write(":");
   }