Java Text File Save writeFile(final String outputDir, final String response, final String fileName)

Here you can find the source of writeFile(final String outputDir, final String response, final String fileName)

Description

write File

License

Open Source License

Declaration

public static void writeFile(final String outputDir,
            final String response, final String fileName)
            throws IOException 

Method Source Code

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

import java.io.File;

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

public class Main {
    public static void writeFile(final String outputDir,
            final String response, final String fileName)
            throws IOException {
        File dir = new File(outputDir);
        dir.mkdirs();//from   ww  w .j a va2 s  .c o  m
        File file = new File(dir, fileName);
        final FileWriter writer = new FileWriter(file);
        try {
            writer.write(response);
        } finally {
            writer.close();
        }
        writer.close();
    }

    public static void writeFile(final File file, final String response)
            throws IOException {
        final FileWriter writer = new FileWriter(file);
        try {
            writer.write(response);
        } finally {
            writer.close();
        }
        writer.close();
    }
}

Related

  1. writeFile(final File outputFile, final String data, final String encoding)
  2. writeFile(final String aText, final File aFile, final String aEncoding)
  3. writeFile(final String file, final String text)
  4. writeFile(final String name, final String s)
  5. writeFile(final String nameFile, final List listMsg)
  6. writeFile(IFile annotationFile, StringBuffer head, String annotatedSignature, String nextLines, BufferedReader tailReader, IProgressMonitor monitor)
  7. writeFile(IFile file, final InputStream contents, final String charset, IProgressMonitor monitor)
  8. writeFile(List data, File f)
  9. writeFile(List fileLines, String pathname)