fileName è:
codice:
public static String readFile (String fileName)
	throws IOException
	{
		InputStream is = null;
		InputStreamReader isr = null;

		StringBuffer sb = new StringBuffer ();
		char[] buf = new char[1024];
		int len;

		try
		{
			is = new FileInputStream (fileName);
			isr = new InputStreamReader (is);

			while ((len = isr.read (buf)) > 0)
				sb.append (buf, 0, len);

			return sb.toString ();
		}
		finally
		{
			if (isr != null)
				isr.close ();
		}
	}