Here you can find the source of readFile(String fileName)
Parameter | Description |
---|---|
fileName | DOCUMENTME |
Parameter | Description |
---|---|
IOException | DOCUMENTME |
private static String readFile(String fileName) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { /**//from w ww .j ava 2 s. c om * DOCUMENTME. * * @param fileName DOCUMENTME * * @return DOCUMENTME * * @throws IOException DOCUMENTME */ private static String readFile(String fileName) throws IOException { byte[] cont = null; File file = new File(fileName); FileInputStream fi = new FileInputStream(file); try { long len = file.length(); cont = new byte[(int) len]; fi.read(cont); } finally { fi.close(); } return new String(cont, "UTF-8"); } }