Java Text File Append fileAppendString(String target, String source)

Here you can find the source of fileAppendString(String target, String source)

Description

Append a string to a file.

License

Open Source License

Parameter

Parameter Description
target The file that gets appended to.
source The string to append.

Declaration

static public void fileAppendString(String target, String source) throws IOException 

Method Source Code

//package com.java2s;
/**//from  www  .  ja  v a  2s .c  o m
 * Util.java
 * @author John Green
 * 27-Oct-2002
 * www.joanju.com
 * 
 * Copyright (c) 2002 Joanju Limited.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 */

import java.io.*;

public class Main {
    /** Append a string to a file.
     * @param target The file that gets appended to.
     * @param source The string to append.
     */
    static public void fileAppendString(String target, String source) throws IOException {
        BufferedWriter out = new BufferedWriter(new FileWriter(target, true));
        out.write(source);
        out.close();
    }
}

Related

  1. appendStringToFile(String fileName, String data)
  2. appendStringToFile(String str, String oFileName)
  3. appendStringToFile(String string, String filename)
  4. FileAppend(String fileNameWithPath, String content)
  5. fileAppend(String target, String source)