Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.InputStreamReader;

public class Main {
    public static String getContent(String fileName) {
        try {

            InputStreamReader inputReader = new InputStreamReader(new FileInputStream(fileName));
            BufferedReader bufReader = new BufferedReader(inputReader);
            String line = "";
            String Result = "";
            while ((line = bufReader.readLine()) != null)
                Result += line;

            //System.out.print(Result);
            return Result;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}