Android Text File Write writeFile(File f, String content)

Here you can find the source of writeFile(File f, String content)

Description

write string s into file f

License

Open Source License

Parameter

Parameter Description
f a parameter
content a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static void writeFile(File f, String content) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * 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
 *
 * Contributors:/*from  w ww . j  av a  2  s  .c  o  m*/
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import java.io.File;

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

public class Main {
    /**
     * write string s into file f
     * 
     * @param f
     * @param content
     * @throws IOException
     */
    public static void writeFile(File f, String content) throws IOException {
        final FileWriter fw = new FileWriter(f);
        fw.append(content);
        fw.close();
    }
}

Related

  1. write(File file, String s, boolean lazy)
  2. write(File file, String s, boolean lazy, boolean append)
  3. write(String fileName, String s)
  4. write(String pathName, String fileName, String s)
  5. write2File(Set set, String path)
  6. writeFile(File file, String content)
  7. writeFile(File file, String content)
  8. writeFile(File file, String content, String encoding)
  9. writeFile(File file, String text)