Here you can find the source of appendToTextFile(final File file, final String text)
Parameter | Description |
---|---|
file | a parameter |
buffer | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void appendToTextFile(final File file, final String text) throws IOException
//package com.java2s; /*/* w w w .j av a 2s . c o m*/ This file is part of the Xapagy Cognitive Architecture Copyright (C) 2008-2017 Ladislau Boloni This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 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 GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; public class Main { /** * Writes the buffer to a Matlab file * * @param file * @param buffer * @throws IOException */ public static void appendToTextFile(final File file, final String text) throws IOException { try (FileOutputStream out = new FileOutputStream(file, true); PrintWriter pw = new PrintWriter(out);) { pw.write(text); pw.flush(); pw.close(); out.close(); } } }