Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.*;

public class Main {
    public static void saveNamedFile(String patch, String data, String name) {

        try {

            File direct = new File(patch);
            if (!direct.exists())
                direct.mkdirs();

            File f = new File(patch + "/" + name);
            if (!f.exists())
                f.createNewFile();

            FileOutputStream fos = new FileOutputStream(f);
            String s = data;
            fos.write(s.getBytes("UTF-8"));
            fos.close();

        } catch (FileNotFoundException e) {
        } catch (IOException e) {
        }

    }
}