* 读取Ascii编码格式的字符 * @param str 文件路径 * @return 读取的内容 */ public String Read_ascii(String str){ boolean newline = false; String content = ""; // 获取的内容信息 String restr=""; try{ InputStream dis=getClass().getResourceAsStream(str); int character; while ((character = dis.read()) != -1) { if ((char) character == '//') { newline = true; continue; } else { if ((char) character == 'n' && newline) { content += "/n"; newline = false; } else if (newline) { content += "//" + (char) character; newline = false; } else { content += (char) character; newline = false; } } } restr=new String(content.getBytes("ISO8859_1"), "GB2312"); }catch(Exception e){ e.printStackTrace(); return null; } return restr; }