Here you can find the source of fileAppend(String target, String source)
Parameter | Description |
---|---|
target | The file that gets appended to. |
source | The file to append. |
static public void fileAppend(String target, String source) throws IOException
//package com.java2s; /**/*from w w w . ja v a 2 s. c om*/ * 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 one file to another. * @param target The file that gets appended to. * @param source The file to append. */ static public void fileAppend(String target, String source) throws IOException { fileThing(source, target, true); } static private void fileThing(String from, String to, boolean append) throws IOException { BufferedReader in = new BufferedReader(new FileReader(from)); BufferedWriter out = new BufferedWriter(new FileWriter(to, append)); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); } }