Java FileWriter Write saveToFile(String fileName, String resultStr)

Here you can find the source of saveToFile(String fileName, String resultStr)

Description

save To File

License

Open Source License

Declaration

public static void saveToFile(String fileName, String resultStr) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static void saveToFile(String fileName, String resultStr) {

        try {// w w  w . ja v  a 2  s .c o m
            FileWriter fileWriter;
            File newTextFile = new File(fileName);
            fileWriter = new FileWriter(newTextFile, true);
            fileWriter.write(resultStr);
            fileWriter.close();
        } catch (IOException iOException) {
        }

    }

    public static void saveToFile(String fileName, byte[] data) {
        try {
            try (FileOutputStream out = new FileOutputStream(fileName, true)) {
                out.write(data);
            }
        } catch (IOException iOException) {
            System.err.println(iOException.getMessage());
        }
    }
}

Related

  1. saveToCache(String md, String in, String res)
  2. saveToFile(File file, String string)
  3. saveToFile(File file, String text)
  4. saveToFile(List lines, String pathname)
  5. saveToFile(List list, String filename, boolean append)
  6. saveToFile(String fileName, String str)
  7. saveToFile(String location, File tempFile)
  8. saveToFile(String path, String line)
  9. saveToFile(String prefix, Reader input)