View Javadoc
1   package org.kuali.ole.docstore.xstream;
2   
3   import java.io.BufferedReader;
4   import java.io.File;
5   import java.io.FileReader;
6   import java.io.IOException;
7   
8   /**
9    * Created by IntelliJ IDEA.
10   * User: pvsubrah
11   * Date: 2/20/12
12   * Time: 12:11 AM
13   * To change this template use File | Settings | File Templates.
14   */
15  public class FileUtil {
16  
17      public String readFile(File file) throws IOException {
18          BufferedReader reader = new BufferedReader(new FileReader(file));
19          String line = null;
20          StringBuilder stringBuilder = new StringBuilder();
21          String ls = System.getProperty("line.separator");
22          while ((line = reader.readLine()) != null) {
23              stringBuilder.append(line);
24              stringBuilder.append(ls);
25          }
26          return stringBuilder.toString();
27      }
28  }