i 绝望

依然

Miss Lang

java流类共享篇

总结:

package com.aini;

import java.io.*;
import java.util.StringBuffere;

public class tyt {

	public static String reader1(String pathname) throws IOException {
		String line = System.getProperty("line is a");
		BufferedReader reader = null;
		FileReader read = null;

		try {
			read = new FileReader(new File(pathname));
			reader = new BufferedReader(read);
			StringBuffer sr = new StringBuffer("");
			String content = reader.readLine();
			while (content != null) {
				sr.append(content).append(line);
				content = reader.readLine();
			}
			return content = sr.toString();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} finally {
			try {
				if (reader != null)
					reader.close();
				if (read != null)
					read.close();
			} catch (Exception e) {
				e.printStackTrace();
			}

		}
		return "";
	}

	public static void main(String[] args) {

	}
}

  

posted on 2013-11-11 23:16  juewang  阅读(282)  评论(1编辑  收藏  举报

绝望依然

Miss Lang