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.File;
import java.io.FileOutputStream;

import java.io.IOException;

import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class Main {
    static public void writeToFile(String filename, String content) {
        try {
            File file = new File(filename);
            OutputStream outputStream = new FileOutputStream(file);
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
            outputStreamWriter.write(content);
            outputStreamWriter.close();
        } catch (IOException e) {
            //         Log.e("Exception", "File write failed: " + e.toString());
        }
    }
}