Here you can find the source of readFile(IFile theFile)
public static String readFile(IFile theFile) throws CoreException, IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; public class Main { public static String readFile(IFile theFile) throws CoreException, IOException { InputStream is = theFile.getContents(); Reader r = new InputStreamReader(is); StringBuilder data = new StringBuilder(); /*/*from w ww .ja v a 2 s.c o m*/ * buffer size hack -- if there's a good implementation of * available, then we'll go through the buffer in one try */ char[] buffer = new char[Math.max(1024, is.available())]; int charsRead; while ((charsRead = r.read(buffer)) >= 0) data.append(buffer, 0, charsRead); return data.toString(); } }