Here you can find the source of readFileWithThrow(IFile in)
public static String readFileWithThrow(IFile in) throws CoreException, IOException
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; public class Main { public static String readFileWithThrow(IFile in) throws CoreException, IOException { InputStream contents = in.getContents(); return readStream(contents); }// ww w.j a v a 2 s . c o m public static String readStream(InputStream is) throws IOException { Reader in = new BufferedReader(new InputStreamReader(is)); StringBuilder result = new StringBuilder(2048); char[] buff = new char[2048]; for (;;) { int c = in.read(buff); if (c <= 0) break; result.append(buff, 0, c); } return result.toString(); } }