Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
    public static FileOutputStream getFileOutputStream(String filePath) throws IOException {
        FileOutputStream out;
        File file = new File(filePath);
        if (file.getParentFile().exists()) {
            file.getParentFile().delete();
        }
        file.getParentFile().mkdirs();
        file.createNewFile();
        out = new FileOutputStream(file);
        return out;
    }
}