Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { private static final String CHARSET = "UTF-8"; public static String read(String wbPath) { File file = new File(wbPath); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); int len = fis.available(); if (len > 0) { byte[] buf = new byte[len]; fis.read(buf); String string = new String(buf, CHARSET); return string; } } catch (Exception e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } finally { if (fis != null) try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; } }