BOM!

BOM(Byte Order Mark)
http://www.atmarkit.co.jp/aig/01xml/bom.html


BOMを踏まないための簡単な例をlogる。

private String loadFile(String fileName) throws IOException {
	File f = new File(fileName);
	int len = (int) f.length();
	byte[] b = new byte[len];
	FileInputStream fis = null;
	try {
		fis = new FileInputStream(f);
		fis.read(b, 0, len);
		String s = new String(b, "utf-8");
		if (s.charAt(0) == 65279)
			return s.substring(1);
		return s;
	} finally {
		if (fis != null)
			fis.close();
	}
}