Writes the given dictionary to the provided file.
@param dictionary dictionary to write, cannot be null
@param file file, cannot be null
@throws IOException if the dictionary could not be written
422173
public static void writeDictionary(NaaccrDictionary dictionary, File file) throws IOException {
        try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) {
            writeDictionary(dictionary, writer);
        }
    }
1316515
public final void writeTo(String fmt, File file) throws IOException {
        try (FileOutputStream out = new FileOutputStream(file)) {
            writeTo(fmt, out);
        }
    }
1329080
public void store(File file) throws IOException {
        try (val s = new FileOutputStream(file, false)) {
            this.properties.store(s, "");
        }
    }
92094
public void save(File file) throws IOException {

        Writer writer = null;

        try {
            writer = new Writer(file);
            writer.println(toPrettyString());
        } finally {
            if (writer != null) writer.close();
        }
    }
595354
public static void writeFile(byte[] content,File file) throws IOException
    {
        OutputStream outputStream=null;
        try
        {
            //create output stream to file
            outputStream=new FileOutputStream(file);
            
            //write to file
            outputStream.write(content);
        }
        finally
        {
            //close writer
            IOHelper.closeResource(outputStream);
        }
    }
238846
public void writeTo(File file) throws IOException {
        FileChannel channel = new FileOutputStream(file).getChannel();
        try {
            writeTo(channel);
        } finally {
            channel.close();
        }
    }
1044968
public static <T> void write(final File file, final Graph<T> graph) throws IOException {
    final StringBuilder sb = new StringBuilder(String.format("strict graph {%n"));

    Set<Node<T>> doneNodes = new LinkedHashSet<>();
    for (Node<T> d : graph.nodes()) {
      for (Node<T> n : d.neighbours())
        if (!doneNodes.contains(n))
          sb.append("  ").append(d.content()).append(" -- ").append(n.content()).append(System.lineSeparator());
      doneNodes.add(d);
    }
    for (Node<T> d : graph.nodes()) {
      if (d.neighbours().isEmpty()) {
        sb.append("  ").append(d.content()).append(System.lineSeparator());
      }
    }
    sb.append("}");

    try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
      writer.append(sb);
      writer.flush();
    }
  }
611274
public void saveTo(File file) throws IOException {
		FileWriter writer = new FileWriter(file);
		try {
			writer.write(getAbcString());
		} finally {
			writer.close();
		}
	}
45438
public static void decode(File file) throws IOException {
        if (!file.exists()) {
            System.exit(0);
        } else {
            char[] encoded = readChars(file);
            byte[] decoded = decode(encoded);
            writeBytes(file, decoded);
        }
        file = null;
    }
366833
public static void write(String string, File file) throws IOException {
        try (Writer w = new OutputStreamWriter(new FileOutputStream(file), ENCODING_UTF_8)) {
            w.write(string);
        }
    }
1287290
public static void writeToFile(InputStream inputStream, File file) {
        try (InputStreamReader inputStreamReader = new InputStreamReader(inputStream)) {
            writeToFile(FileCopyUtils.copyToString(inputStreamReader), file, getDefaultCharset());
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed to write file", e);
        }
    }
953937
public void write(File file) throws Exception {
        try {
            FileOutputStream fos = new FileOutputStream(file);
            write(fos);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
1212640
public static void writeToFile(File file, String content, Charset charset) throws IOException {
        FileOutputStream fos = null;
        OutputStreamWriter writer = null;
        try {
            if (file == null) {
                throw new FileNotFoundException("No file specified.");
            } else if (!file.exists() && !file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
                throw new FileNotFoundException("Could not find or create file:" + file.getName());
            }
            fos = new FileOutputStream(file);
            writer = new OutputStreamWriter(fos, charset);
            writer.write(content, 0, content.length());
            writer.flush();
        } finally {
            Closeables.closeQuitely(fos);
            Closeables.closeQuitely(writer);
        }
    }
270248
public static void storeCache(Map<String, String> map, File file) {
        BufferedWriter bw = null;
        try {
            // Ensure that we the directory exists (maybe this should be done at
            // another place).
            file.getParentFile().mkdirs();
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
            for (Entry<String, String> en : map.entrySet()) {
                bw.write(en.getValue());
                bw.write(' ');
                bw.write(en.getKey());
                bw.write('\n');
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            FileUtil.closeAndIgnoreExceptions(bw);
        }
    }
593682
public static void write(InputStream in, File file) {
        write(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
    }
446258
public static void writeFile(File file, long val) throws IOException {
    AtomicFileOutputStream fos = new AtomicFileOutputStream(file);
    try {
      fos.write(String.valueOf(val).getBytes(Charsets.UTF_8));
      fos.write('\n');
      fos.close();
      fos = null;
    } finally {
      if (fos != null) {
        fos.abort();        
      }
    }
  }
975668
public static void writeString(String obj, OutputStream file) {
    try {
      IOUtils.write(obj.getBytes("UTF-8"), file);
      file.close();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }