codice:
String readFile(String fileName) {
  StringBuffer buffer = new StringBuffer();
  try {
    FileReader in = new FileReader(fileName);
    char[] ch = new char[1024];
    int r;
    while ((r = in.read(ch)) > 0) {
      buffer.append(ch, 0, r);
    }
    in.close();
    return buffer.toString();
  }
  catch (IOException ioex) {
    return null;
  }
}