Advertisement
amigojapan

Untitled

Feb 19th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package testapp;
  8. import java.io.BufferedReader;
  9. import java.io.File;
  10. import java.io.FileNotFoundException;
  11. import java.io.FileReader;
  12. import java.io.IOException;
  13. import java.util.logging.Level;
  14. import java.util.logging.Logger;
  15.  
  16. /**
  17.  *
  18.  * @author amigojapan
  19.  */
  20. public class FileIn {
  21.     private String data;
  22.     public FileIn(String filename,String encoding) throws FileNotFoundException, IOException {//implementing encoding later
  23.         BufferedReader reader;
  24.         reader = new BufferedReader(new FileReader(filename)); //Implement encoding later, see http://www.mkyong.com/java/how-to-read-utf-8-encoded-data-from-a-file-java/
  25.         String line = "";
  26.         this.data="";
  27.         while ((line = reader.readLine()) != null) {
  28.             this.data+=line+"\n";
  29.         }
  30.        
  31.     }
  32.     public String GetData() {
  33.     return this.data;
  34.     }        
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement