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.File;

import java.io.FileReader;

public class Main {
    public static String readFileToString(String fullPath) throws Exception {
        File file = new File(fullPath);
        BufferedReader bufRead = new BufferedReader(new FileReader(file));
        StringBuffer strBuf = new StringBuffer();
        String readString = null;
        String readLine = null;
        while ((readLine = bufRead.readLine()) != null) {
            strBuf.append(readLine);
        }
        readString = strBuf.toString();
        return readString;

    }
}