Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.*;

public class Main {
    public static String readFile(File f) {
        try {
            FileInputStream fstream = new FileInputStream(f);
            InputStreamReader in = new InputStreamReader(fstream);
            BufferedReader br = new BufferedReader(in);
            String strLine;
            StringBuilder sb = new StringBuilder();
            while ((strLine = br.readLine()) != null) {
                sb.append(strLine);
                sb.append('\n');
            }
            br.close();
            in.close();
            fstream.close();
            return sb.toString();
        } catch (Exception ex) {
            return "";
        }
    }
}