Java PrintWriter Create getPrintWriter(File f)

Here you can find the source of getPrintWriter(File f)

Description

Get a PrintWriter for the specified file, throw RuntimeExcpetion if any problems.

License

Open Source License

Declaration

public static PrintWriter getPrintWriter(File f) 

Method Source Code


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

import java.io.File;

import java.io.FileOutputStream;
import java.io.PrintWriter;

public class Main {
    /** Get a PrintWriter for the specified file, throw RuntimeExcpetion
     * if any problems.//from w ww .  j a  va 2  s .  c om
     */
    public static PrintWriter getPrintWriter(File f) {
        try {
            return new PrintWriter(new FileOutputStream(f));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
}

Related

  1. getPrintWriter(File file)
  2. getPrintWriter(File file)
  3. getPrintwriter(File file, boolean append)
  4. getPrintWriter(final File aFile, final boolean append)