2012-07-14 8 views

Respuesta

13

El truco es el siguiente:

FileInputStream fs = new FileInputStream(f); 
3

Puede utilizar este enfoque:

BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(new File("text.txt"))))); 

    String line = null; 

    while ((line = reader.readLine()) != null) { 
     // do something with your read line 
    } 

o esta otra:

byte[] bytes = Files.readAllBytes(Paths.get("text.txt")); 
    String text = new String(bytes, StandardCharsets.UTF_8); 
Cuestiones relacionadas