Come posso leggere un file di testo come in Android:La lettura di un file di testo utilizzando InputStream
"1.something written
2.in this file
3.is to be read by
4.the InputStream
..."
così posso essere restituito una stringa del tipo:
"something written\nin this file\nis to be read by\nthe InputStream"
quello che ho pensato di IS (Pseudocodice):
make an inputstream
is = getAssest().open("textfile.txt"); //in try and catch
for loop{
string = is.read() and if it equals "." (i.e. from 1., 2., 3. etc) add "/n" ...
}
Sarebbe utile per fornire un contesto per come e dove utilizzare il codice – Adonis
se si dispone di un file txt e u desidera leggere il file di testo utilizzando FileInputStream è possibile farlo e ..... ..... nel tuo file fe = new File (abc.txt); e questo sarà visualizzato nella tua console read data String str = new String (data); System.out.println (str); – Ziyad
Il risultato di .read (dati) viene ignorato –