Java FileWriter Write saveBufferInFile(String buffer, File filename)

Here you can find the source of saveBufferInFile(String buffer, File filename)

Description

save Buffer In File

License

Open Source License

Declaration

public static void saveBufferInFile(String buffer, File filename) throws IOException 

Method Source Code

//package com.java2s;
/**//from   www .  j ava 2s  .c  om
 * AADL-RAMSES
 * 
 * Copyright ? 2012 TELECOM ParisTech and CNRS
 * 
 * TELECOM ParisTech/LTCI
 * 
 * Authors: see AUTHORS
 * 
 * This program is free software: you can redistribute it and/or modify 
 * it under the terms of the Eclipse Public License as published by Eclipse,
 * either version 1.0 of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Eclipse Public License for more details.
 * You should have received a copy of the Eclipse Public License
 * along with this program.  If not, see 
 * http://www.eclipse.org/org/documents/epl-v10.php
 */

import java.io.BufferedWriter;
import java.io.File;

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void saveBufferInFile(String buffer, File filename) throws IOException {
        BufferedWriter writer = null;

        try {
            writer = new BufferedWriter(new FileWriter(filename));
            writer.write(buffer);
        } finally {
            if (writer != null) {
                writer.close();
            }
        }
    }
}

Related

  1. save2File(String fileName, String content)
  2. save_array(double[] array, String fname)
  3. saveAllToFile(String filename, String... strings)
  4. saveArrayNames(int[] array, String[] names, String fname)
  5. saveAuthFile(String fileName, String raw)
  6. saveCCS(Map contributionScore, String diseaseState, String file)
  7. saveColumn(int[] density, String filename)
  8. saveConfig(File conf, Map data)
  9. saveContent(String context, String filename)