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

import java.io.OutputStream;

public class Main {

    public static OutputStream readFromFile(String path, String fileName) {
        if (path.charAt(path.length() - 1) != '/') {
            path += '/';
        }

        File file = new File(path + fileName);
        OutputStream os = null;
        try {
            os = new FileOutputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return os;
    }
}