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 readTestFile(String file) {
        try {
            BufferedReader r = new BufferedReader(new FileReader(new File("test_data/" + file)));
            StringBuffer sb = new StringBuffer();
            String s = null;
            while ((s = r.readLine()) != null)
                sb.append(s);

            return sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
}