Here you can find the source of saveBufferInFile(String buffer, File filename)
public static void saveBufferInFile(String buffer, File filename) throws IOException
//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(); } } } }