Konciznost

Čitanje tekst fajla u string.

U Javi:

File aFile = new File("/home/jablan/blah.txt");
StringBuffer contents = new StringBuffer();
    
try {
  BufferedReader input =  new BufferedReader(new FileReader(aFile));
  try {
    String line = null;
    while (( line = input.readLine()) != null){
      contents.append(line);
      contents.append(System.getProperty("line.separator"));
    }
  }
  finally {
    input.close();
  }
}
catch (IOException ex){
  ex.printStackTrace();
}

return contents.toString();

U Rubiju:

return File.read('/home/jablan/blah.txt')

:D

jablan | 31.05.08. | [5] komentari / comments
O sajtu
Autori
FAQ
Linkovi

Kategorije

Lično
Opšte
Pretraživači
Razvoj
Softver
Veb

Pretraga sajta

Arhiva

po datumu
po kategoriji

RSS 0.91

Powered by
pMachine