Java Text File Save writeFile(final String file, final String text)

Here you can find the source of writeFile(final String file, final String text)

Description

Method declaration

License

Open Source License

Parameter

Parameter Description
file a parameter
text a parameter

Declaration

static void writeFile(final String file, final String text) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

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

public class Main {
    /**/*from   w  ww.  j a  va  2 s. c  om*/
     * Method declaration
     *
     * @param file
     * @param text
     */
    static void writeFile(final String file, final String text) {

        try {
            final FileWriter write = new FileWriter(file);

            write.write(text.toCharArray());
            write.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. writeFile(final byte[] content, final String path)
  2. writeFile(final File destination, final List contents)
  3. writeFile(final File f, final String content)
  4. writeFile(final File outputFile, final String data, final String encoding)
  5. writeFile(final String aText, final File aFile, final String aEncoding)
  6. writeFile(final String name, final String s)
  7. writeFile(final String nameFile, final List listMsg)
  8. writeFile(final String outputDir, final String response, final String fileName)
  9. writeFile(IFile annotationFile, StringBuffer head, String annotatedSignature, String nextLines, BufferedReader tailReader, IProgressMonitor monitor)