Skip to content

Commit

Permalink
Fichero de prueba creado, y código para leer sus lineas
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbh committed Oct 6, 2019
1 parent 5fa3578 commit 1287bbe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
10 changes: 10 additions & 0 deletions fichero.txt
@@ -0,0 +1,10 @@
1
2
3
4
5
6
7
8
9
10
19 changes: 16 additions & 3 deletions src/main/java/org/tecnificados/com/lector/App.java
@@ -1,13 +1,26 @@
package org.tecnificados.com.lector;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.io.FileUtils;

/**
* Hello world!
*
* Lector de ficheros linea a linea
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
List<String> readedLines = new ArrayList<String>();
try {
readedLines = FileUtils.readLines(new File("fichero.txt"),"utf-8");
System.out.println("Lineas: "+readedLines.size());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

0 comments on commit 1287bbe

Please sign in to comment.