Java Text File Write writeStringToFile(String value, String path)

Here you can find the source of writeStringToFile(String value, String path)

Description

write String To File

License

Open Source License

Declaration

public static void writeStringToFile(String value, String path) throws IOException 

Method Source Code

//package com.java2s;
/*//  w  w  w. ja  v a 2 s  .com
 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva.
 *
 * This file may be distributed under the terms of the Q Public License
 * as defined by Trolltech AS of Norway and appearing in the file
 * LICENSE.QPL included in the packaging of this file.
 *
 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING
 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
    public static void writeStringToFile(String value, String path) throws IOException {
        final FileOutputStream fos = new FileOutputStream(path);
        fos.write(value.getBytes());
        fos.close();
    }
}

Related

  1. writeStringToFile(String stringToWrite, String fileName)
  2. writeStringToFile(String text, File file)
  3. writeStringToFile(String text, String file)
  4. writeStringToFile(String text, String filePath)
  5. WriteStringToFile(String toWrite, String filePath)