2008-06-10

文件操作!

//读文件转成字符串!
	public static String fileToString(String fileName) throws IOException {

		String lineContent = null;// 
		StringBuffer str = new StringBuffer();
		FileReader fr;
		try {
			fr = new FileReader(fileName);
			BufferedReader br = new BufferedReader(fr);//
			lineContent = new String();
			lineContent = br.readLine().trim();
			do {
				str.append(lineContent.trim());
			} while ((lineContent = br.readLine()) != null);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str.toString();
	}


评论
发表评论

您还没有登录,请登录后发表评论

qianlei007
搜索本博客
博客分类
我的相册
6536229d-9cc6-3920-a3ce-43fb1ed73bca-thumb
http_imgload
共 6 张
最近加入圈子
存档
最新评论