|
|
@ -1,9 +1,30 @@ |
|
|
|
package com.jesuspinar.main; |
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
public class Main { |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
readTxt("/Users/jesuspl/SpringTool_workspace/miCat/src/com/jesuspinar/main/test.txt"); |
|
|
|
} |
|
|
|
|
|
|
|
public static String readTxt(String path) { |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
try (FileReader fileReader = new FileReader(new File(path)); |
|
|
|
BufferedReader bf = new BufferedReader(fileReader)) { |
|
|
|
String ln; |
|
|
|
while ((ln = bf.readLine()) != null) { |
|
|
|
sb.append(ln); |
|
|
|
System.out.printf("%s", ln); |
|
|
|
} |
|
|
|
}catch (IOException ioe){ |
|
|
|
System.err.println("Archivo no valido"); |
|
|
|
} |
|
|
|
return sb.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |