java RandomAccessFile raf = null; byte[] buffer; String text = null;
try
{
raf = new RandomAccessFile("Solution399.java", "r");
buffer = new byte[(int)raf.length()]; raf.read(buffer);
text = new String(buffer);
}
import java.io.RandomAccessFile;
import java.io.IOException;
import java.io.FileNotFoundException;
public class Solution399 {
public static void main(String[] args) throws IOException {
RandomAccessFile raf = null; byte[] buffer; String text = null;
try
{
raf = new RandomAccessFile("Solution399.java", "r");
buffer = new byte[(int)raf.length()]; raf.read(buffer);
text = new String(buffer);
}
catch (FileNotFoundException e) { System.out.println("FNF"); }
catch (IOException e) { System.out.println("IOE"); }
catch (OutOfMemoryError e) { System.out.println("OOM"); }
catch (Exception e) { System.out.println("E"); }
finally { if (raf != null) raf.close(); }
}
}