Here you can find the source of loadAsciiTxt()
private static void loadAsciiTxt() throws IOException
//package com.java2s; //License from project: Apache License import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; public class Main { private static char[][] ascii; private static void loadAsciiTxt() throws IOException { if (ascii == null) { try { String[] split = readInputStream("ascii.txt").split("\n"); ascii = new char[16][16]; for (int i = 0; i < split.length; i++) { ascii[i] = split[i].toCharArray(); }//ww w . jav a 2 s .c om } catch (Exception e) { throw new IOException("Ascii file is invalid.", e); } } } private static String readInputStream(String name) throws IOException { InputStream in = ClassLoader.getSystemResourceAsStream(name); if (in == null) { throw new IOException(name + " does not exist."); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { while (in.available() > 0) { baos.write(in.read()); } return baos.toString("utf-8"); } finally { closeQuietly(in); closeQuietly(baos); } } private static void closeQuietly(Closeable close) { if (close != null) { try { close.close(); } catch (IOException e) { // be quiet } } } }