Java FileOutputStream Create getOutputStream(String path)

Here you can find the source of getOutputStream(String path)

Description

get Output Stream

License

Apache License

Declaration

public static OutputStream getOutputStream(String path) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {

    public static OutputStream getOutputStream(String path) throws IOException {
        return new FileOutputStream(touch(path));
    }/*w  ww . j  av  a  2s . c om*/

    public static File touch(String fullFilePath) throws IOException {
        if (fullFilePath == null) {
            return null;
        }
        File file = new File(fullFilePath);

        file.getParentFile().mkdirs();
        if (!file.exists())
            file.createNewFile();
        return file;
    }
}

Related

  1. getOutputStream(String fileName)
  2. getOutputStream(String filename)
  3. getOutputStream(String filename, Map map)
  4. getOutputStream(String filename, String dir)
  5. getOutputStream(String fname, String enc, boolean append)
  6. getOutputStream(String path)
  7. getOutputStream(String root, String name, boolean overwrite, boolean verbose)
  8. getOutputStream(String theFilePath)
  9. getOutputStreamForFile(final File file)